Skip to content

Commit 7a9bc61

Browse files
committed
added options template and ReadMe hint
1 parent bf46482 commit 7a9bc61

File tree

2 files changed

+98
-2
lines changed

2 files changed

+98
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ This was created as part of my own learning process and you will find that git c
1414
I am also using this codebase as an experiment towards hiring people (freshers especially but not limited to them) for my development team. If you are in Mumbai and are interested to join my team, you can use this codebase in the following manner:
1515

1616
* Fork the codebase
17-
* Build your own application using this as a base, or complete a TODO or fix a bug
17+
* Add your own firebase_options.dart (follow steps and see firebase_options.template)
18+
* **Build your own application using this as a base (integrating any existing project of yours also works)**, or complete a TODO or fix a bug (only if you have no other ideas)
1819
* Send me a Pull Request. Mention a way of connecting with you in the commit message along with details of commit. Also modify ReadMe to say what you have changed in detail.
1920
* I will go through the request and then connect with you if I find the entry to be interesting and take an interview round.
2021

21-
2222
## The Steps
2323

2424
Step 1: Use Get CLI [https://pub.dev/packages/get_cli]

lib/firebase_options.template

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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

Comments
 (0)