Error in Flutter while using Provider tool - flutter

I am building a basic app using flutter, in which I had to use provider, I added Provider dependencies in pubspec.yaml file but getting this error please help, I added the error below not able to fix this problem I have the latest flutter SDK

To solve this use lower version of Provider dependency as newer version of provider depends on newer version of Flutter SDK and your application's Flutter SDK is old one so it will have compatibility issues, So just degrade the version of dependency or you can also run pub outdated command and it will suggest you compatible version as per your SDK.

Related

Audioplayer plugins using a deprecated version of the android embedding

I want to add Audioplayer package for my xylophone app but on running it, I get this following error:
The plugins audioplayers, path_provider use a deprecated version of
the Android embedding. To avoid unexpected runtime failures, or future
build failures, try to see if these plugins support the Android V2
embedding. Otherwise, consider removing them since a future release of
Flutter will remove these deprecated APIs. If you are plugin author,
take a look at the docs for migrating the plugin to the V2 embedding:
https://flutter.dev/go/android-plugin-migration.
I was having the same problem while using audioplayers library. So, after looking up on the internet I found out that I was using the old version of the dependency of audio player. So, I suggest you to check for the latest version of audioplayers library from https://pub.dev/packages/audioplayers, and add it in your dependency as
dependencies:
audioplayers: ^0.20.1
(For me it was 0.20.1). You can check for latest to avoid error. Hope it works for you.

The plugin admob_flutter uses a deprecated version of the Android embedding

when i put admob_flutter: ^2.0.0-nullsafety.1 in pubspec, and type on cmd flutter pub get this error occurs!
The plugin admob_flutter uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of
Flutter will remove these deprecated APIs.
It's for latest flutter updates. so you can't do anything. Please use other package or wait till fix the problem by package developer because this error is produced after flutter version 2.5.
I have downgraded my flutter version by command flutter downgrade and it shows an option of a downgraded flutter version and it resolves my error.
Downgrading flutter worked for me.

Dart 2.6 and Flutter, Upgrading Dependency

Using Flutter, I am trying to update my dart dependency 2.6.0 but I get an error
Because *project_name* requires SDK version >=2.6.0 <3.0.0, version solving failed.
pub get failed (1)
exit code 1
I want to use the new features that dart offers, such as Extension Methods. How could I go about upgrading my dependency? I have installed the newest stable version of dart on my computer, but regardless I still get that error.
A couple of things that might help:
From this issue, you can try ensuring that you've updated enviroment in your pubspec.yaml file like so:
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
Another thing that might help is just double checking the steps in this post or on the dart installation page to ensure that you've updated to the latest version correctly.

How to use cloud_firestore in flutter for web and android?

I have a Flutter app which works on Android as expected but if I want to compile it for Web I get an error.
It has to do something with the dependency cloud_firestore. If I use the dependency firebase it works fine on the web but on android now not..
This is the error message I get using cloud_firestore (compiling for web):
Skipping compiling pay_balance|lib/main_web_entrypoint.dart with ddc because some of its
transitive libraries have sdk dependencies that not supported on this platform:
firebase_core|lib/firebase_core.dart
https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-resolve-skipped-compiling-warnings
Can anybody help me? Maybe with another dependency for firestore (I did not find others which are working on web and android)..
Edit: I have used the firebase-dart plugin for web!! -> Only works on the web but not in android for me -> I need something for both at the same time!!
Or is there a Way I can use both packages without getting a compling error for the web when I import cloud_firestore?
If you want to use Firebase on Web and Mobile you have to get creative. I created the fb_auth plugin that uses the Mobile SDK firebase_auth on iOS and Android and the firebase package on web. This will give you a single plugin for auth.
https://pub.dev/packages/fb_auth
Im working on firstore and storage but they are not ready yet.
I have also created an article on how to do this with flutter:
https://medium.com/#rody.davis.jr/how-to-build-a-native-cross-platform-project-with-flutter-372b9e4b504f
You have to use dynamic imports so that at compile time it tree shakes what it doesn't need and will not throw an error.
Currently this is the only way to officially use both plugins in the same project.
EDIT: cloud_firestore now added
Two of the FutterFire plugins are now supported for web. FlutterFire plugins supporting web firebase_auth and firebase_core
cloud_firestore is now also supported

google_maps_flutter and AndroidX migration

I am working on a project that requires google_maps_flutter package. When selecting the option Run -> Flutter run in Release Mode I receive:
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See for more information on the problem and how to fix it.
If I follow the documentation to Avoiding AndroidX from the official page:
https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility#avoiding-androidx
I have the following issue:
The last available version pre AndroidX for google_maps_flutter is 0.1.0
Seems that this version does not exist.
Log Error:
Because depends on google_maps_flutter 0.1.0 which doesn't match any versions, version solving failed.
pub get failed (1)
Is there a solution for this problem?
You are facing the issue because the package version is too old.
Latest version for google_maps_flutter is 0.5.13
Follow instructions which are mentioned in the Google maps flutter package here
Follow instructions from here to migrate your flutter app to AndroidX.