error message after using notifier 1.0.2 plugin in flutter - flutter

I was looking for an alternative for Broadcast receiver in flutter then I got a plugin notifier 1.0.2 after adding to my pubspec.yaml getting an error message like
Because every version of notifier depends on synchronized ^1.5.3+2 and sqflite 1.2.0 depends on synchronized >=2.0.2 <4.0.0, notifier is incompatible with sqflite 1.2.0.
So, because Bluis depends on both sqflite 1.2.0 and notifier 1.0.2, version solving failed.
pub get failed (1; So, because Bluis depends on both sqflite 1.2.0 and notifier 1.0.2, version solving failed.)
Process finished with exit code 1
here is my pubspec.yaml
name: Bluis
description: A new Flutter project.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.2.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
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
rxdart: ^0.22.3
http: ^0.12.0+1
toast: ^0.1.5
sqflite: 1.2.0
intl: ^0.16.0
geolocator: ^5.1.4+2
flutter_compass: ^0.3.4
url_launcher: ^5.2.5
permission_handler: ^4.0.0
camera: ^0.5.2+1
video_player: ^0.10.0
path_provider: ^1.1.0
path: ^1.6.2
e2e: ^0.2.0
esys_flutter_share: ^1.0.2
shared_preferences: ^0.5.4+5
connectivity: ^0.4.5+3
uuid: ^2.0.4
logger: ^0.6.0
event_bus: ^1.1.0
location: ^2.3.4
dio: ^3.0.8
recase: ^3.0.0
flutter_map:
git:
url: git://github.com/okaxaki/flutter_map.git
ref: fix/support-flutter-1.10
dev_dependencies:
flutter_test:
sdk: flutter
notifier: 1.0.2
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/
- assets/locale/localization_en.json
- assets/locale/localization_hi.json
- assets/locale/localization_or.json

I solved my purpose by using event bus
Create an Event Bus
EventBus eventBus = EventBus();
Define Events (Create a class with event name with constructor)
class UserLoggedInEvent {
User user;
UserLoggedInEvent(this.user);
}
Register Listeners (Listen to your events)
eventBus.on<UserLoggedInEvent>().listen((event) {
// All events are of type UserLoggedInEvent (or subtypes of it).
print(event.user);
});
Fire your event
User myUser = User('Mickey');
eventBus.fire(UserLoggedInEvent(myUser));
cancel your all events
eventBus.cancel();

Related

Flutter mobx mobx_codegen generates null safety code for computed getters

Using mobx and mobx_codegen for Flutter.
My code is NOT null safe (sdk: ">=2.7.0 <3.0.0").
When mobx_codegen generates code for #computed getters, it uses null safety, which won't compile...
Sample class counter (look at #computed):
import 'package:mobx/mobx.dart';
// Include generated file
part 'counter.g.dart';
// This is the class used by rest of your codebase
class Counter = _Counter with _$Counter;
// The store-class
abstract class _Counter with Store {
#observable
int value = 0;
#computed
int get test => 0;
#action
void increment() {
value++;
}
}
Relevant generated code (counter.g.dart):
Computed<int>? _$testComputed;
Shows this error:
This requires the 'non-nullable' language feature to be enabled.
Try updating your pubspec.yaml to set the minimum SDK constraint to 2.12.0 or higher, and running 'pub get'.
I'm new to mobx, am I doing something wrong?
How´s it going?
I am with the same issue in my project. I installed the new flutter version and after that my project stopped to compile. I changed my dependences of mobx, flutter_mobx, mobx_codegen and build_runner and them worked.
My first dependences:
mobx: ^1.2.1+4
flutter_mobx: ^1.1.0+2
build_runner: ^1.11.5
mobx_codegen: ^1.1.2
My last dependences:
mobx: ^2.0.6+1
flutter_mobx: ^2.0.4
build_runner: ^2.1.7
mobx_codegen: ^2.0.5+2
From there, It has started my issue of "#computed" while I run the build_runner.
I changed the Dart SDK of my project and It stopped to show error of "#computed". But broke all source code because I developed my code with "non- null-safety".
So, looking for replies. I figured out the root cause is the specifically the mobx_codegen newer dependency that uses null safety and doesn´t have a tratament to valid our Dart SDK.
In my opnion, It should´ve validated while running of build_runner.
So, Someone knows how could I resolve that issue?
I have a commercial solution of app, and I´ve planned to release until 3 months.
my pubspec.yaml is so:
name: XPTO
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
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: ^1.0.2
mobx: ^2.0.6+1
flutter_mobx: ^2.0.4
get_it: ^7.2.0
flutter_search_bar: ^3.0.0-dev.1
carousel_slider: ^4.0.0
intl: ^0.17.0
image_picker: ^0.8.4+5
image_cropper: ^1.4.1
parse_server_sdk_flutter: ^3.1.0
cpf_cnpj_validator: ^2.0.0
brasil_fields: ^1.3.0
mask_text_input_formatter: ^2.1.0
badges: ^2.0.2
flutter_rating_bar: ^4.0.0
expandable: ^5.0.1
flutter_easyloading: ^3.0.3
internet_connection_checker: ^0.0.1+3
cached_network_image: ^3.2.0
flutter_keyboard_visibility: ^5.1.1
json_annotation: ^4.4.0
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^2.1.7
mobx_codegen: ^2.0.5+2
graphs: ^2.1.0
json_serializable: ^6.1.4
dependency_overrides:
plugin_platform_interface: ^2.0.0
build_resolvers: ^2.0.6
web_socket_channel: ^2.0.0
analyzer: ^3.2.0
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
assets:
- images/logo.jpeg
- images/empty.jpg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
Since you're using a version of MobX that has null-safety, you can either:
migrate your code to null-safety (recommended).
downgrade your mobx, mobx_codegen and build_runner packages to a version that doesn't have null-safety.
To migrate your code, you can follow this Migration Guide.
If you opt to downgrade, be aware that you might run into version conflicts and there's a chance you have to downgrade your Flutter SDK too.

Flutter libraries incompatibility

I'm working on a flutter project which I'm not the one who developed it first time. After running pub get I have these massive amount of errors:
Because xdg_directories >=0.1.2 <0.2.0-nullsafety.0 depends on process >=3.0.12 <5.0.0 and xdg_directories <0.1.2 depends on process ^3.0.12, xdg_directories <0.2.0-nullsafety.0 requires process >=3.0.12 <5.0.0.
(1) So, because path_provider_linux <0.2.0-nullsafety depends on xdg_directories ^0.1.0, path_provider_linux <0.2.0-nullsafety requires process >=3.0.12 <5.0.0.
Because process >=4.0.0-nullsafety.1 <4.0.0-nullsafety.4 requires SDK version >=2.10.0-0.0 <2.12.0 and process >=4.0.0-nullsafety.4 <4.0.0 depends on platform ^3.0.0-nullsafety.4, process >=4.0.0-nullsafety.1 <4.0.0 requires platform ^3.0.0-nullsafety.4.
And because process >=3.0.12 <4.0.0-nullsafety.1 depends on intl >=0.14.0 <0.17.0 and process >=4.0.0 depends on platform ^3.0.0, process >=3.0.12 requires platform ^3.0.0-nullsafety.4 or intl >=0.14.0 <0.17.0.
(2) So, because path_provider_linux <0.2.0-nullsafety requires process >=3.0.12 <5.0.0 (1), path_provider_linux <0.2.0-nullsafety requires platform ^3.0.0-nullsafety.4 or intl >=0.14.0 <0.17.0.
Because shared_preferences_linux <=0.0.2 depends on path_provider ^1.6.11 and shared_preferences_linux >=0.0.4-nullsafety <2.0.0 depends on shared_preferences_platform_interface ^2.0.0-nullsafety, shared_preferences_linux <0.0.2+1 or >=0.0.4-nullsafety <2.0.0-∞ requires path_provider ^1.6.11 or shared_preferences_platform_interface ^2.0.0-nullsafety.
And because shared_preferences_linux >=0.0.2+1 <0.0.4-nullsafety depends on path_provider_linux ^0.0.1 and path_provider >=1.6.10 <2.0.0-nullsafety depends on path_provider_linux ^0.0.1, shared_preferences_linux <2.0.0 requires shared_preferences_platform_interface ^2.0.0-nullsafety or path_provider_linux ^0.0.1.
And because path_provider_linux <0.2.0-nullsafety requires platform ^3.0.0-nullsafety.4 or intl >=0.14.0 <0.17.0 (2), shared_preferences_linux <2.0.0 requires platform ^3.0.0-nullsafety.4 or intl >=0.14.0 <0.17.0 or shared_preferences_platform_interface ^2.0.0-nullsafety.
And because every version of flutter_localizations from sdk depends on intl 0.17.0 and shared_preferences >=0.5.8 <2.0.0-nullsafety depends on shared_preferences_linux ^0.0.2, if flutter_localizations any from sdk and shared_preferences >=0.5.8 <2.0.0-nullsafety then platform ^3.0.0-nullsafety.4 or shared_preferences_platform_interface ^2.0.0-nullsafety.
And because shared_preferences >=0.5.4+8 <2.0.0-nullsafety depends on shared_preferences_platform_interface ^1.0.0 and every version of localize_and_translate depends on flutter_localizations any from sdk, if shared_preferences >=0.5.8 <2.0.0-nullsafety and localize_and_translate any then platform ^3.0.0-nullsafety.4.
And because localize_and_translate ^3.0.3 depends on shared_preferences ^0.5.12+4 and firebase_messaging >=0.2.0 <7.0.2 depends on platform ^2.0.0, localize_and_translate ^3.0.3 is incompatible with firebase_messaging >=0.2.0 <7.0.2.
So, because educationtqnia depends on both firebase_messaging ^6.0.13 and localize_and_translate ^3.0.3, version solving failed.
pub get failed (1; So, because educationtqnia depends on both firebase_messaging ^6.0.13 and localize_and_translate ^3.0.3, version solving failed.)
Process finished with exit code 1
This is my pubspec-yaml file:
name: educationtqnia
description: education_tqnia
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+7
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
permission_handler: ^5.0.0+hotfix.4
dio: ^3.0.8
firebase_messaging: ^6.0.13
flutter_local_notifications: ^1.1.3
connectivity: ^0.4.8+2
video_player: ^0.10.9+1
image_picker: ^0.6.5+3
cupertino_icons: ^0.1.3
http: ^0.12.0+2
flutter_launcher_icons: ^0.7.2+1
flutter_rounded_date_picker: 0.3.0
rflutter_alert: ^1.0.2
intro_slider: ^2.2.9
font_awesome_flutter: ^8.8.1
shared_preferences: ^0.5.6+3
fluttertoast: ^4.0.0
percent_indicator: ^2.1.1+1
responsive_builder: ^0.1.5
chewie: ^0.9.10
wc_flutter_share: ^0.2.0
flutter_record: ^0.4.3+1
cached_network_image: ^2.2.0
gradient_text: ^1.0.2
flutter_youtube: "^2.0.0"
flutter_pdfview: ^1.0.3+2
url_launcher: ^5.5.0
webview_flutter: ^1.0.7
full_screen_image: any
dev_dependencies:
flutter_test:
sdk: flutter
localize_and_translate: ^3.0.3
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/icon.png"
flutter_zoom_plugin:
git:
url: git://github.com/decodedhealth/flutter_zoom_plugin.git
ref: 0.0.8
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- langs/ar.json
- langs/en.json
- assets/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
fonts:
- family: Cairo
fonts:
- asset: assets/fonts/Cairo-Black.ttf
- asset: assets/fonts/Cairo-Bold.ttf
- asset: assets/fonts/Cairo-ExtraLight.ttf
- asset: assets/fonts/Cairo-Light.ttf
- asset: assets/fonts/Cairo-Regular.ttf
- asset: assets/fonts/Cairo-SemiBold.ttf
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
I tried downgrading the flutter SDK, switching between channels and running changing the libraries version to solve the problem but nothing work. Any ideas how to solve this problem?
Thanks.
This problem is very common when Flutter or some plugins have been updated. The only thing that works for me is to update everything, both flutter and the plugins to their latest version and if one is incompatible because it has no maintenance, try to change it for another.
Adding to Miguels answers - you could file issues on the relevant libraries GitHub pages if you need them to be usable on the newest flutter version aswell as compatible with other libraries.

Why I can not add some packages to pubspec.yaml file?

When I try to add flutter_sound: ^7.7.0+1 to dependencies in pubspec.yaml and press to "pub get",,I recieve error message below, How can I solve this issue??
pubspec.yaml
name: lezzet_kitabi
description: A new Flutter application.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
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: ^1.0.2
bordered_text: ^1.0.1
sqflite: ^1.3.0
path_provider: ^1.6.27
provider: ^4.3.3
integration_test: ^1.0.2+2
camera: 0.5.8+17
image_picker: ^0.6.7+22
path: ^1.8.0
flutter_sound: ^7.7.0+1
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- images/logoBGopacity.png
- images/logoBG.png
- images/cuttedlogo.PNG
- images/sticker0.png
- images/sticker1.png
- images/sticker2.png
- images/sticker3.png
- images/sticker4.png
- images/sticker5.png
- images/sticker6.png
- images/sticker7.png
- images/sticker8.png
- images/sticker9.png
- images/sticker10.png
- images/sticker11.png
- images/sticker12.png
- images/sticker13.png
- images/sticker14.png
- images/sticker15.png
- images/sticker16.png
- images/sticker17.png
- images/sticker18.png
- images/sticker19.png
- images/sticker20.png
- images/sticker21.png
- images/sticker22.png
- images/stickerForRecipeScreen.png
fonts:
- family: Marck
fonts:
- asset: fonts/MarckScript-Regular.ttf
- family: Graduate
fonts:
- asset: fonts/Graduate-Regular.ttf
- family: OpenSans
fonts:
- asset: fonts/OpenSansCondensed-Light.ttf
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
Error
Because flutter_sound >=6.4.3+42 depends on uuid ^2.2.2 which depends on crypto ^2.0.0, flutter_sound >=6.4.3+42 requires crypto ^2.0.0.
And because every version of flutter_driver from sdk depends on crypto 3.0.0, flutter_sound >=6.4.3+42 is incompatible with flutter_driver from sdk.
And because integration_test 1.0.2+2 depends on flutter_driver any from sdk and no versions of integration_test match >1.0.2+2 <2.0.0, flutter_sound >=6.4.3+42 is incompatible with integration_test ^1.0.2+2.
So, because lezzet_kitabi depends on both integration_test ^1.0.2+2 and flutter_sound ^7.7.0+1, version solving failed.
pub get failed (1; So, because lezzet_kitabi depends on both integration_test ^1.0.2+2 and flutter_sound ^7.7.0+1, version solving failed.)
This problem is due to your project's dependencies depending on other packages.
There is a conflict in their versioning which can be resolved, as per the documentation.
You can read about it here (Official Flutter Docs).

Exclude option doesn't work properly by Dart Analyzer

I am using the Flutter INTL package in my app for internationalization. The package generates a generated folder and I want the analyzer to ignore it.
I followed the Exclude code from analysis article however, it seems it doesn't work as two of the generated files won't be disappeared from the list.
This is my pubspec.yaml file.
name: luma_app
description: Luma My Account
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
# Firebase related libraries
firebase_core: ^0.5.3 # https://pub.dev/packages/firebase_core
firebase_crashlytics: ^0.2.4 # https://pub.dev/packages/firebase_crashlytics
firebase_analytics: ^6.3.0 # https://pub.dev/packages/firebase_analytics
firebase_auth: ^0.18.4+1 # https://pub.dev/packages/firebase_auth
cloud_firestore: ^0.14.4 # https://pub.dev/packages/cloud_firestore
firebase_storage: ^5.2.0 # https://pub.dev/packages/firebase_storage
# Internationalization package helps us to manage different languages
intl: ^0.16.1 # https://pub.dev/packages/intl
provider: ^4.3.2+3 # https://pub.dev/packages/provider
google_fonts: ^1.1.1 # https://pub.dev/packages/google_fonts
package_info: ^0.4.3+2 # https://pub.dev/packages/package_info/install
shared_preferences: ^0.5.12+4 # https://pub.dev/packages/shared_preferences
get_it: ^5.0.3 # https://pub.dev/packages/get_it
flutter_svg: ^0.19.1 # https://pub.dev/packages/flutter_svg
native_pdf_view: ^3.9.0 # https://pub.dev/packages/native_pdf_view
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.9.2 # https://pub.dev/packages/pedantic
# effective_dart: ^1.3.0 # https://pub.dev/packages/effective_dart
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
generate: true # This is for localizations. Don't remove it.
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- assets/google_fonts/
- assets/images/
flutter_intl:
enabled: true
and finally, this is the content of my analysis_options.yaml file.
# For more information visit:
# https://dart.dev/guides/language/analysis-options
#include: package:pedantic/analysis_options.yaml
# or
include: package:pedantic/analysis_options.1.9.0.yaml
#include: package:effective_dart/analysis_options.1.3.0.yaml
analyzer:
exclude:
- lib/generated/**
# strong-mode:
# implicit-casts: false
# implicit-dynamic: false
# errors:
# prefer_single_quotes: ignore
linter:
rules:
- camel_case_types
Dart/OS versions:
==> dart --version
Dart SDK version: 2.10.4 (stable) (Wed Nov 11 13:35:58 2020 +0100) on "macos_x64"
I realized that the documentation needs to be updated. You just need to remove lib/ from the path. So this configuration would work:
analyzer:
exclude:
- generated/**

Dependence incompatible in my flutter project

[source] flutter.bat pub get
Running "flutter pub get" in source...
Because rate_my_app >=0.6.0+3 depends on shared_preferences ^0.5.7 and fstore depends on shared_preferences 0.5.3+4, rate_my_app >=0.6.0+3 is forbidden.
So, because fstore depends on rate_my_app ^0.6.1+2, version solving failed.
pub get failed (1; So, because fstore depends on rate_my_app ^0.6.1+2, version solving failed.)
exit code 1
Here is my pubspec.yaml:
name: fstore
description: Mobile commerce app by Flutter
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# `enter code here`https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.3.0+1
environment:
sdk: ">=2.2.2 <3.0.0"
dependencies:
logs:
git: https://github.com/pq/logs
flutter:
sdk: flutter
intl: 0.16.1
http: 0.12.0+2
html_unescape: 1.0.1+3
provider: ^3.0.0+1
flutter_signin_button: ^0.2.8
after_layout: 1.0.7+2
font_awesome_flutter: ^8.5.0
path: 1.7.0
flutter_facebook_login: ^2.0.1
flutter_account_kit: 0.7.0
vector_math: 2.0.8
carousel_pro: ^1.0.0
flutter_widget_from_html_core: ^0.2.2+1
configurable_expansion_tile: ^1.0.0
timeago: ^2.0.18
share: ^0.6.2+1
validate: ^1.7.0
country_pickers: ^1.1.0
shared_preferences: ^0.5.7
firebase_messaging: 5.1.2
firebase_analytics: 4.0.2
transparent_image: 1.0.0
pull_to_refresh: ^1.5.0
localstorage: ^2.0.0
notification_permissions: ^0.4.0
flare_splash_screen: 2.1.3
rate_my_app: ^0.6.0+3
flutter_range_slider: ^1.3.1
page_indicator: ^0.2.0
global_configuration: ^1.1.0
extended_image: 0.5.3
flutter_screenutil: 0.5.3
fluttertoast: ^3.1.0
intro_slider: ^2.2.5
url_launcher: ^5.1.0
firebase_core: ^0.4.0+8
firebase_auth: ^0.11.1+12
cloud_firestore: ^0.12.7+1
firestore_ui: ^1.6.0
flutter_webview_plugin: ^0.3.5
connectivity: ^0.4.3+6
random_string: ^1.1.0
google_maps_flutter: 0.5.19+2
place_picker: 0.9.8
cached_network_image: ^2.0.0-rc
firebase_storage: ^3.0.4
image_picker: ^0.6.0+17
fab_circular_menu: 0.1.1
uuid: ^2.0.2
flutter_localizations:
sdk: flutter
dev_dependencies:
flutter_launcher_icons: ^0.7.2+1
flutter_test:
sdk: flutter
# Run this script to generate the app icon: flutter pub pub run flutter_launcher_icons:main
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/images/app_icon.png"
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
uses-material-design: true
assets:
- lib/common/config.json
- assets/icons/categories/
- assets/icons/tabs/
- assets/icons/profile/
- assets/icons/payment/
- assets/images/
- assets/images/country/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.io/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.io/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
fonts:
- family: Raleway
fonts:
- asset: assets/fonts/Raleway-Regular.ttf
- asset: assets/fonts/Raleway-Medium.ttf
- asset: assets/fonts/Raleway-Bold.ttf
- asset: assets/fonts/Raleway-Light.ttf
- asset: assets/fonts/Raleway-Thin.ttf
- family: Roboto
fonts:
- asset: assets/fonts/Roboto-Regular.ttf
- asset: assets/fonts/Roboto-Medium.ttf
- asset: assets/fonts/Roboto-Bold.ttf
- asset: assets/fonts/Roboto-Light.ttf
- asset: assets/fonts/Roboto-Thin.ttf
#
# For details regarding fonts from package dependencies,
# see https://flutter.io/custom-fonts/#from-packages
I have this problem how can i solve it?
I'd suggest looking here:
https://dart.dev/tools/pub/dependencies#dependency-overrides
You can override the version number of all dependencies, but be careful as later versions might contain breaking changes that your dependencies might not work with.
In your pubspec.yaml file, add this:
dependency_overrides:
rate_my_app: ^0.6.0+3
I have solved this. You need to update the rate_my_app to 0.6.0+3 and shared_preferences to 0.5.7+3 and then hit packages get.