firebase_options.dart 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // File generated by FlutterFire CLI.
  2. // ignore_for_file: type=lint
  3. import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
  4. import 'package:flutter/foundation.dart'
  5. show defaultTargetPlatform, kIsWeb, TargetPlatform;
  6. import 'package:flutter_dotenv/flutter_dotenv.dart';
  7. /// Default [FirebaseOptions] for use with your Firebase apps.
  8. ///
  9. /// Example:
  10. /// ```dart
  11. /// import 'firebase_options.dart';
  12. /// // ...
  13. /// await Firebase.initializeApp(
  14. /// options: DefaultFirebaseOptions.currentPlatform,
  15. /// );
  16. /// ```
  17. class DefaultFirebaseOptions {
  18. static FirebaseOptions get currentPlatform {
  19. if (kIsWeb) {
  20. throw UnsupportedError(
  21. 'DefaultFirebaseOptions have not been configured for web - '
  22. 'you can reconfigure this by running the FlutterFire CLI again.',
  23. );
  24. }
  25. switch (defaultTargetPlatform) {
  26. case TargetPlatform.android:
  27. return android;
  28. case TargetPlatform.iOS:
  29. return ios;
  30. case TargetPlatform.macOS:
  31. throw UnsupportedError(
  32. 'DefaultFirebaseOptions have not been configured for macos - '
  33. 'you can reconfigure this by running the FlutterFire CLI again.',
  34. );
  35. case TargetPlatform.windows:
  36. throw UnsupportedError(
  37. 'DefaultFirebaseOptions have not been configured for windows - '
  38. 'you can reconfigure this by running the FlutterFire CLI again.',
  39. );
  40. case TargetPlatform.linux:
  41. throw UnsupportedError(
  42. 'DefaultFirebaseOptions have not been configured for linux - '
  43. 'you can reconfigure this by running the FlutterFire CLI again.',
  44. );
  45. default:
  46. throw UnsupportedError(
  47. 'DefaultFirebaseOptions are not supported for this platform.',
  48. );
  49. }
  50. }
  51. static final FirebaseOptions android = FirebaseOptions(
  52. apiKey: dotenv.env['ANDROID_API_KEY']!,
  53. appId: dotenv.env['ANDROID_APP_ID']!,
  54. messagingSenderId: dotenv.env['ANDROID_MESSAGING_SENDER_ID']!,
  55. projectId: dotenv.env['ANDROID_PROJECT_ID']!,
  56. storageBucket: dotenv.env['ANDROID_STORAGE_BUCKET']!,
  57. );
  58. static final FirebaseOptions ios = FirebaseOptions(
  59. apiKey: dotenv.env['IOS_API_KEY']!,
  60. appId: dotenv.env['IOS_APP_ID']!,
  61. messagingSenderId: dotenv.env['IOS_MESSAGING_SENDER_ID']!,
  62. projectId: dotenv.env['IOS_PROJECT_ID']!,
  63. storageBucket: dotenv.env['IOS_STORAGE_BUCKET']!,
  64. iosBundleId: dotenv.env['IOS_BUNDLE_ID']!,
  65. );
  66. }