Skip to content

admin panel web app

flutter create admin_panel

Get firebase

paru -S firebase-tools-bin

Configure firebase in the flutter project

Source: https://firebase.google.com/docs/flutter/setup?platform=web

firebase login 

dart pub global activate flutterfire_cli
flutterfire configure

Select the platforms your configuration should support using Space key to toggle selection:

1748016697.png

After the flutterfire configure you'll two changes:

  1. lib/firebase_options.dart is created
  2. In the fireabse console you see the newly registered web app.

1748101828.png

More app configuration to connect with firebase.

# updates pubspec.yaml
flutter pub add firebase_core
# updates lib/firebase_options.dart
flutterfire configure
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
  runApp(const MyApp());
}

Now to add specific plugins from the firebase ecosystem, check out this link. https://firebase.google.com/docs/flutter/setup?platform=web#available-plugins

Authentication setup

Phone authentication: https://firebase.google.com/docs/auth/flutter/phone-auth

For authentication, we use firebase_auth. But the authetication data is contained in cloud firestore within the same project so we include cloud_firestore as well.

flutter pub add firebase_auth cloud_firestore

In Firebase Console:

  • Go to Authentication → Sign-in method
  • Enable "Phone" as a sign-in provider

App Check with reCAPTCHA

source: https://firebase.google.com/docs/app-check/web/recaptcha-provider


Comments