|
| 1 | +// This is a template of the file generated by FlutterFire CLI. |
| 2 | +// Actual file will be .dart extension |
| 3 | +// ignore_for_file: type=lint |
| 4 | +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; |
| 5 | +import 'package:firebase_storage/firebase_storage.dart'; |
| 6 | +import 'package:flutter/foundation.dart' |
| 7 | + show defaultTargetPlatform, kIsWeb, TargetPlatform; |
| 8 | + |
| 9 | +/// Default [FirebaseOptions] for use with your Firebase apps. |
| 10 | +/// |
| 11 | +/// Example: |
| 12 | +/// ```dart |
| 13 | +/// import 'firebase_options.dart'; |
| 14 | +/// // ... |
| 15 | +/// await Firebase.initializeApp( |
| 16 | +/// options: DefaultFirebaseOptions.currentPlatform, |
| 17 | +/// ); |
| 18 | +/// ``` |
| 19 | +class DefaultFirebaseOptions { |
| 20 | + static FirebaseOptions get currentPlatform { |
| 21 | + if (kIsWeb) { |
| 22 | + return web; |
| 23 | + } |
| 24 | + switch (defaultTargetPlatform) { |
| 25 | + case TargetPlatform.android: |
| 26 | + return android; |
| 27 | + case TargetPlatform.iOS: |
| 28 | + return ios; |
| 29 | + case TargetPlatform.macOS: |
| 30 | + return macos; |
| 31 | + case TargetPlatform.windows: |
| 32 | + return windows; |
| 33 | + case TargetPlatform.linux: |
| 34 | + throw UnsupportedError( |
| 35 | + 'DefaultFirebaseOptions have not been configured for linux - ' |
| 36 | + 'you can reconfigure this by running the FlutterFire CLI again.', |
| 37 | + ); |
| 38 | + default: |
| 39 | + throw UnsupportedError( |
| 40 | + 'DefaultFirebaseOptions are not supported for this platform.', |
| 41 | + ); |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + static const FirebaseOptions web = FirebaseOptions( |
| 46 | + apiKey: 'YOUR_API_KEY', |
| 47 | + appId: 'YOUR_APP_ID', |
| 48 | + messagingSenderId: 'YOUR_MESSAGING_ID', |
| 49 | + projectId: 'YOUR_PROJECT_ID', |
| 50 | + authDomain: 'YOUR_PROJECT_ID.firebaseapp.com', |
| 51 | + storageBucket: 'YOUR_PROJECT_ID.appspot.com', |
| 52 | + measurementId: 'YOUR_MEASUREMENT_ID', |
| 53 | + ); |
| 54 | + |
| 55 | + static const String webClientId = |
| 56 | + 'YOUR_APP_ID.apps.googleusercontent.com'; |
| 57 | + |
| 58 | + static const FirebaseOptions android = FirebaseOptions( |
| 59 | + apiKey: 'YOUR_APP_ID', |
| 60 | + appId: 'YOUR_APP_ID', |
| 61 | + messagingSenderId: 'YOUR_MESSAGING_ID', |
| 62 | + projectId: 'YOUR_PROJECT_ID', |
| 63 | + storageBucket: 'YOUR_PROJECT_ID.appspot.com', |
| 64 | + ); |
| 65 | + |
| 66 | + static const FirebaseOptions ios = FirebaseOptions( |
| 67 | + apiKey: 'YOUR_API_KEY', |
| 68 | + appId: 'YOUR_APP_ID', |
| 69 | + messagingSenderId: 'YOUR_MESSAGING_ID', |
| 70 | + projectId: 'YOUR_PROJECT_ID', |
| 71 | + storageBucket: 'YOUR_PROJECT_ID.appspot.com', |
| 72 | + iosBundleId: 'com.example.complete', |
| 73 | + ); |
| 74 | + |
| 75 | + static const FirebaseOptions macos = FirebaseOptions( |
| 76 | + apiKey: 'YOUR_API_KEY', |
| 77 | + appId: 'YOUR_APP_ID', |
| 78 | + messagingSenderId: 'YOUR_MESSAGING_ID', |
| 79 | + projectId: 'YOUR_PROJECT_ID', |
| 80 | + storageBucket: 'YOUR_PROJECT_ID.appspot.com', |
| 81 | + iosBundleId: 'com.example.complete', |
| 82 | + ); |
| 83 | + |
| 84 | + static const FirebaseOptions windows = FirebaseOptions( |
| 85 | + apiKey: 'YOUR_API_KEY', |
| 86 | + appId: 'YOUR_APP_ID', |
| 87 | + messagingSenderId: 'YOUR_MESSAGING_ID', |
| 88 | + projectId: 'YOUR_PROJECT_ID', |
| 89 | + authDomain: 'YOUR_PROJECT_ID.firebaseapp.com', |
| 90 | + storageBucket: 'YOUR_PROJECT_ID.appspot.com', |
| 91 | + measurementId: 'YOUR_MEASUREMENT_ID', |
| 92 | + ); |
| 93 | + |
| 94 | + final storage = |
| 95 | + FirebaseStorage.instanceFor(bucket: "gs://YOUR_PROJECT_ID.appspot.com"); |
| 96 | +} |
0 commit comments