firestore_ref 0.10.0+5 firestore_ref: ^0.10.0+5 copied to clipboard
Firestore reference/document typed acccess helpers. You can write organized safe code by this.
import 'package:cloud_functions/cloud_functions.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firestore_ref/firestore_ref.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart' hide Router;
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'app.dart';
import 'util/util.dart';
Future<void> main() async {
const isEmulator = bool.fromEnvironment('IS_EMULATOR');
logger.fine('start(isEmulator: $isEmulator)');
firestoreOperationCounter.enabled = true;
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
if (isEmulator) {
FirebaseFunctions.instance.useFunctionsEmulator(
origin: 'http://$emulatorDomain:5001',
);
useFirestoreEmulator();
} else if (kIsWeb) {
FirebaseFirestore.instance.settings = const Settings(
persistenceEnabled: true,
);
}
runApp(
ProviderScope(
child: App(),
),
);
}