- Add Firebase.initializeApp() call in mainCommon.dart before any Firebase-dependent code - Make mainCommon() async to support await Firebase.initializeApp() - Update mainDev.dart to properly await mainCommon() call - Add android:enableOnBackInvokedCallback='true' to AndroidManifest.xml to fix OnBackInvokedCallback warning This resolves the 'No Firebase App [DEFAULT] has been created' error that was occurring when firebase_messaging tried to access FirebaseMessaging.instance in homePage.dart. Firebase must be initialized before any Firebase APIs are used.
28 lines
805 B
Dart
28 lines
805 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:redux/redux.dart';
|
|
|
|
import 'globals.dart' as globals;
|
|
import 'mainCommon.dart';
|
|
|
|
enum LogLevel { none, actions, all }
|
|
|
|
void main() async {
|
|
globals.isDevelopment = true;
|
|
debugPrint("Is development!");
|
|
|
|
// Simple logging middleware para desarrollo
|
|
Middleware<dynamic> createLoggingMiddleware() {
|
|
return (Store<dynamic> store, dynamic action, NextDispatcher next) {
|
|
debugPrint(">>>>> ${action.toString().replaceAll('Instance of ', '')}");
|
|
next(action);
|
|
};
|
|
}
|
|
|
|
LogLevel logRedux = LogLevel.actions;
|
|
|
|
List<Middleware<dynamic>> devMiddlewares =
|
|
logRedux == LogLevel.actions ? [] : [createLoggingMiddleware()];
|
|
|
|
// In development, Sentry is disabled, so we skip initialization
|
|
await mainCommon(devMiddlewares);
|
|
}
|