Appendix
📚 Appendix
For your info
Exception has occurred.
PlatformException (PlatformException(Error performing getDocuments, FAILED_PRECONDITION: The query requires an index. You can create it here: https://console.firebase.google.com/v1/r/project/gdgflutterfirebasechat/firestore/indexes?create_composite=ClRwcm9qZWN0cy9nZGdmbHV0dGVyZmlyZWJhc2VjaGF0L2RhdGFiYXNlcy8oZGVmYXVsdCkvY29sbGVjdGlvbkdyb3Vwcy9jaGF0cy9pbmRleGVzL18QARoMCghzZW5kZXJJZBABGgwKCHRvVXNlcklkEAEaDQoJdGltZXN0YW1wEAIaDAoIX19uYW1lX18QAg, null))
Error with Firebase sdk add for Flutter 2.8
https://stackoverflow.com/questions/52060516/how-to-change-android-minsdkversion-in-flutter-project
updatelocal.properties
flutter.minSdkVersion=21flutter.targetSdkVersion=30flutter.compileSdkVersion=30
Change like this from build.gradle
...android {compileSdkVersion localProperties.getProperty('flutter.compileSdkVersion').toInteger()defaultConfig {minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()versionCode flutterVersionCode.toInteger()versionName flutterVersionName}
Error with firebase and IOS
[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform
open [YourProject]/ios/Podfile and remove the # sign from platform :ios, '9.0'
and try flutter run
. If it doesn't work increase the version number for example to 11.0
delete podfile.lock and run these commands
flutter cleancd iospod deintegratepod repo updatepod install
Explain
Talk about Provider and StreamBuilder
runApp(MultiProvider(providers: [Provider<AuthService>(create: (_) => AuthService(),)], child: MyApp()))
home: StreamBuilder<FirebaseUser>(stream: Provider.of<AuthService>(context,listen: false).user,builder: (BuildContext context, AsyncSnapshot snapshot) {if (snapshot.hasData) {return HomeScreen();} else {return LoginScreen();}},),
Index for query
Additional Screenshots
Test mode and - eu-west
You should have node installed.
Open a terminal window and navigate to the directory for your code:
Initiate your project:
$ firebase init
Deploy your functions:
$ firebase deploy