Skip to content

Commit

Permalink
firebase web service
Browse files Browse the repository at this point in the history
  • Loading branch information
LynxLynxx committed Oct 2, 2024
1 parent e10ca57 commit 4384380
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 10 additions & 0 deletions lib/core/services/firebase_web_service.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import 'package:carlog/firebase_options.dart';
import 'package:firebase_core/firebase_core.dart';

class FirebaseWebService {
init() async {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
}
}
6 changes: 2 additions & 4 deletions lib/main_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import 'dart:js' as js;
import 'dart:ui';

import 'package:carlog/core/addons/bloc_observer.dart';
import 'package:carlog/core/services/firebase_web_service.dart';
import 'package:carlog/core/theme/theme.dart';
import 'package:carlog/core/web_router/router.dart';
import 'package:carlog/features/other_features/theme_mode/presentation/cubit/theme_mode_cubit.dart';
import 'package:carlog/features/settings_features/settings/presentation/cubit/language_cubit/language_cubit.dart';
import 'package:carlog/firebase_options.dart';
import 'package:carlog/shared/device/presentation/cubit/device_cubit.dart';
import 'package:carlog/shared/events/presentation/cubit/events_cubit.dart';
import 'package:carlog/web_features/web_contact/domain/repositories/contact_repository.dart';
Expand All @@ -27,9 +27,7 @@ Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
final firebaseConfig = js.context['firebaseConfig'];
if (firebaseConfig == null) {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
await FirebaseWebService().init();
} else {
await Firebase.initializeApp(
options: FirebaseOptions(
Expand Down

0 comments on commit 4384380

Please sign in to comment.