From c2b4fccc4dd0a7087e7d0dfd2d6cf9ca31bbb775 Mon Sep 17 00:00:00 2001 From: xAlpharax <42233094+xAlpharax@users.noreply.github.com> Date: Sun, 5 Nov 2023 04:46:48 +0200 Subject: Hooking up the whole firebase of the project via firebase CLI. Also used flutter_fire firebase_core among several other libs. Changes to be committed: new file: client_app_flutter/android/app/google-services.json modified: client_app_flutter/android/build.gradle new file: client_app_flutter/ios/Runner/GoogleService-Info.plist new file: client_app_flutter/ios/firebase_app_id_file.json new file: client_app_flutter/lib/firebase_options.dart modified: client_app_flutter/lib/main.dart modified: client_app_flutter/pubspec.lock modified: client_app_flutter/pubspec.yaml --- client_app_flutter/lib/firebase_options.dart | 75 ++++++++++++++++++++++++++++ client_app_flutter/lib/main.dart | 7 ++- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 client_app_flutter/lib/firebase_options.dart (limited to 'client_app_flutter/lib') diff --git a/client_app_flutter/lib/firebase_options.dart b/client_app_flutter/lib/firebase_options.dart new file mode 100644 index 0000000..74ffc72 --- /dev/null +++ b/client_app_flutter/lib/firebase_options.dart @@ -0,0 +1,75 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + return web; + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + return ios; + case TargetPlatform.macOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for macos - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.windows: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for windows - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions web = FirebaseOptions( + apiKey: 'AIzaSyD-EugJi1MyqWe4l8G4DqtjykEeqnevsT8', + appId: '1:443484865448:web:dffd1d739cceccf25c539d', + messagingSenderId: '443484865448', + projectId: 'meteo-board', + authDomain: 'meteo-board.firebaseapp.com', + storageBucket: 'meteo-board.appspot.com', + measurementId: 'G-7GCWGR3SVN', + ); + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyAY0cu67hMFb_5BHj3iG9afj73d_7UMSY0', + appId: '1:443484865448:android:896502083b5ab60d5c539d', + messagingSenderId: '443484865448', + projectId: 'meteo-board', + storageBucket: 'meteo-board.appspot.com', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyAtgMdecbtsvfeUFxCMw9GzJ1hlwgoRWg8', + appId: '1:443484865448:ios:2616959ce13fc6615c539d', + messagingSenderId: '443484865448', + projectId: 'meteo-board', + storageBucket: 'meteo-board.appspot.com', + iosBundleId: 'com.example.clientAppFlutter', + ); +} diff --git a/client_app_flutter/lib/main.dart b/client_app_flutter/lib/main.dart index dda5554..e00d0ae 100644 --- a/client_app_flutter/lib/main.dart +++ b/client_app_flutter/lib/main.dart @@ -1,6 +1,11 @@ import 'package:flutter/material.dart'; -void main() { +import 'package:firebase_core/firebase_core.dart'; +import 'package:client_app_flutter/firebase_options.dart'; + +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); runApp(const MyApp()); } -- cgit v1.2.3