how to add firebase_messaging dependency without application failture - firebase

I need to get device token for sending notifications. When I add firebase_messaging dependency, my application is not working or opening. It says that "application is unfortunately stopped". A demo application for testing 'notification sending function' is working on my versions. Could anyone help this?
dependencies:
cloud_firestore:
google_sign_in:
firebase_storage:
fluttertoast:
shared_preferences:
image_picker:
cached_network_image:
intl:
firebase_auth: ^0.8.4+5
flutter:
sdk: flutter
cupertino_icons: ^0.1.2

Related

How do I fix Firestore Flutter dependencies error?

I keep getting the same error on firebase versions
This is the YAML:
provider: ^4.3.3
firebase_database: ^4.4.0
firebase_core: ^0.7.0
firebase_auth: ^0.20.0+1
firebase_crashlytics: ^0.4.0+1
cloud_firestore: ^0.12.7+1
cloud_functions: ^0.9.0
firebase_storage: ^7.0.0
firebase_messaging: ^8.0.0-dev.14
How do I handle this?.
Every time i change one of the versions, another one get error.
Use the latest dependencies, the errors will go away. Update them in your pubspec.yaml file.

Version solving errror with firebase in flutter with some dependancies

I'm getting version-solving errors when trying to add firebase to my flutter project. I have already configured firebase on os and the last step is running flutter pub get. I commented out basic_utils to see if there would be any other conflicts, which is why I know it won't work with google_fonts either. Anybody know what I am doing wrong here? I suspect there are other dependencies that it will conflict with. Is this just something where I have to use an older version of firebase to make it work?
So, because jd_app depends on both firebase_storage ^8.0.0 and google_fonts ^1.1.1, version solving failed.
So, because jd_app depends on both basic_utils ^2.7.1 and firebase_auth ^1.0.1, version solving failed.
Dependencies:
dependencies:
flutter:
sdk: flutter
basic_utils: ^2.7.1
cupertino_icons: ^1.0.1
firebase_auth: ^1.0.1
firebase_core: ^1.0.1
firebase_database: ^6.1.0
firebase_storage: ^8.0.0
flutter_svg: ^0.19.3
get: ^3.24.0
google_fonts: ^1.1.1
image: ^2.1.19
maps_launcher: ^1.2.2+2
provider: ^4.3.3
url_launcher: ^5.5.0
xml: ^4.2.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.8.1
These are currently the stable version of firebase
firebase_core: ^0.7.0
firebase_auth: ^0.20.1
firebase_storage: ^7.0.0
cloud_firestore: ^0.16.0+1
After a search on the web, it seems that version solving can be easily remedied by following the instructions from this website:
https://iiro.dev/2018/08/28/resolving-dart-package-version-conflicts/ .
According to the link, the dependencies in conflict should be allotted the value 'any.' For example:
firebase_database: any
Subsequently, enter flutter packages get, open the newly generated pubspec.lock file, and then change the version of the dependency in your yaml file to the one in the lock file. Run flutter packages get once more and there should be no more conflicts. At least I didn't have any.
Update ALL the dependencies to the latest version. Check pub.dev to get the current versions

Flutter firebase version solving error arise after using firebase auth and firebase core dependencies

I'm having this issue when I've added firebase_auth dependency in my flutter project. Can anyone please help me with it?
dependencies:
cached_network_image: ^2.2.0+1
provider: ^4.3.2
firebase_core: ^0.4.5
velocity_x: ^0.4.1
flushbar: ^1.10.4
firebase_auth: ^0.16.1
flutter_dropdown: ^0.0.7+hotfix.1
You can use the following version:
firebase_core: ^0.4.4+3
firebase_auth: ^0.16.0
Please run
flutter doctor -v
If it is stable channel then use those dependencies. Firebase cause conflict if they are not properly configure.
firebase_auth: ^0.15.4
firebase_core: ^0.4.3+3
Changing to dev channel worked out for me.

Flutter web not working in firebase hosting

I am using firestore in flutter web. Everything is working fine in local i.e,Android studio chrome. But when I hosted in firebase hosting (firebase serve) it's not working. The browser console giving error.
Uncaught TypeError: firebase.firestore is not a function
at Object.arO (top_level.dart:125)
at cloud_firestore_web.dart:26
at alN.a (async_patch.dart:308)
at alN.$2 (async_patch.dart:333)
at Object.N (async_patch.dart:238)
at Object.T8 (main.dart:8)
at js_helper.dart:3221
at js_helper.dart:3221
at dartProgram (js_helper.dart:3221)
at js_helper.dart:3221
pubsec.yaml
name: chitragupta
description: Monthly expenditure tacker
version: 1.2.0+2
environment:
sdk: ">=2.2.2 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
flutter_launcher_icons: ^0.7.2
material_design_icons_flutter: ^4.0.5145
firebase_core: ^0.4.3+2 #For firebase database
firebase_auth: ^0.16.0 #firebase Authentication
shared_preferences: ^0.5.7 #for local storage
shared_preferences_web: ^0.1.2+4
intl: ^0.16.0
flutter_datetime_picker: ^1.2.6
fluttertoast: ^3.1.3
package_info: ^0.4.0+13
image_picker: ^0.6.2+3
http: ^0.12.0+2
charts_flutter: ^0.8.1
flutter_svg: ^0.17.4
cloud_firestore: ^0.13.5
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/
flutter_icons:
image_path: "assets/logo.png"
android: true
ios: true
I don't know where that line of code is written in my flutter project. Any help to solve this?
Update: App working perfectly fine in Godaddy hosting but not in firebase hosting
I have had similar issues. I fixed it by making sure I referenced all of the correct scripts in my index.html file. Look at the available libraries under Step 5 here: https://firebase.google.com/docs/web/setup#available-libraries
The script tags that are included here do not include defer in the script tag and you may need that to fix your issue eg. <script defer src=...>.

Cloud_Firestore Package Flutter / No debug console errors

I am trying to add the cloud_firestore package to my flutter application for web.
After adding the package to dependances app won't run.
Chrome window opens and returns a blank screen. Debug service opens but with no data.
Please help!
Debug console reads
"Debug service listening on ws://127.0.0.1:58031/ACok2ufXaZM="
pubspec.yaml is below
version: 1.0.0+1
environment:
sdk: ">=2.6.0 <3.0.0"
analyzer:
enable-experiment:
- spread-collections
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
firebase_core: ^0.4.0+9
firebase_auth: ^0.14.0+5
firebase_analytics: ^5.0.2
cloud_firestore: ^0.13.4+2
expandable: ^2.2.0
responsive_builder: ^0.1.2
get_it:
provider_architecture:
# path: ../provider_architecture
provider: ^3.1.0
http: ^0.12.0+2
dev_dependencies:
flutter_test:
sdk: flutter

Resources