An Interest In:
Web News this Week
- March 22, 2024
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
Setup Flutter and Firebase
Flutter Firebase
Flutter 2.10.4 | Dart 2.16.2 | DevTools 2.9.2
Create Flutter Project
1) Flutter
flutter create flutter_firebase
Create Firebase Project
1) https://console.firebase.google.com Add Project
2) FlutterFirebase Continue
3) Enable Google Analytics for this project Continue
4) Google Analytics account Create project Continue
Add iOS App
1) iOS Add app to project
2) Terminal flutter_firebase/ios Runner.xcworkspace Xcode
cd flutter_firebasecd iosopen Runner.xcworkspace
3) Xcode Runner Bundle Identifier
4) Firebase Bundle Identifier Apple bundle ID App nickname Register app
5) Download GoogleService-info.plist Next
6) Step 3 4 Next Step 5 Continue to console
7) Xcode Runner Add Files to "Runner"...
8) GoogleService-info.plist Add
9) flutter_firebase VSCode ios/Podfile uncomment platform 10.0
platform :ios, '10.0'
Add Android App
1) Firebase Add app Android icon
2) VSCode android/app/build.gradle applicationId
3) Firebase applicationId Android package name App nickname
4) Terminal flutter_firebase/android grablew SHA1
./gradlew signingReport
5) Firebase SHA1 Debug signing certificate SHA-1 Register app
6) Download google-services.json Next
7) Step 3 Next Step 4 Continue to console
8) VSCode android/build.gradle classpath dependencies ( https://mvnrepository.com/artifact/com.google.gms/google-services?repo=google)
classpath 'com.google.gms:google-services:4.3.10'
9) android/app/build.gradle apply plugin
apply plugin: 'com.google.gms.google-services'
10) minSdkVersion 21 multiDexEnabled defaultConfig
minSdkVersion 21multiDexEnabled true
11) implementation dependencies ( https://mvnrepository.com/artifact/androidx.multidex/multidex)
implementation 'androidx.multidex:multidex:2.0.1'
12) google-services.json android/app
13) Terminal flutter_firebase firebase_core package ( https://pub.dev/packages/firebase_core)
flutter pub add firebase_core
14) pubspec.yaml firebase_core dependencies
Initialize Firebase
1) main.dart
- import firebase_core package
- async main()
- WidgetsFlutterBinding.ensureInitialized()
- Firebase.initializeApp()
import 'package:firebase_core/firebase_core.dart';void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); runApp(const MyApp());}
- Page: https://fb.com/CodeBangkok
- Group: https://fb.com/groups/msdevth
- Blog: https://dev.to/codebangkok
- YouTube: [https://youtube.com/CodeBangkok]
Original Link: https://dev.to/codebangkok/setup-flutter-and-firebase-3718
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To