firebase_manager 0.0.6 copy "firebase_manager: ^0.0.6" to clipboard
firebase_manager: ^0.0.6 copied to clipboard

A package to manage Firebase easily.

example/lib/main.dart

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_manager/firebase_manager.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

import 'ui/firestore/firestore_matcher_page.dart';

void main() {
  FirebaseManager.share.initApp(
    FirebaseInitOptions(
      requiresLogin: true,
      firebaseOptions:
          null as FirebaseOptions, //TODO: Must be DefaultFirebaseOptions.currentPlatform,
      home: () => const FirestoreMatcherPage(),
    ),
  );
}

final router = GoRouter(
  routes: [
    GoRoute(
      path: '/',
      builder: (_, __) => const FirestoreMatcherPage(),
      routes: [
        /// test router by
        /// adb shell 'am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://normidar.com/details"' com.normidar.firebase_manager_example
        GoRoute(
          path: 'details',
          builder: (_, state) => Scaffold(
            appBar: AppBar(title: const Text('Details Screen')),
            body: Center(
              child: Text(state.params.toString()),
            ),
          ),
        ),
      ],
    ),
  ],
);

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('ABC'),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () async {
          final mainColl = fs.db.fireStore.getMainColl();
          final doc = mainColl.getDoc('abc');
          await doc.checkFieldExists('fsdf');
        },
      ),
    );
  }
}