Target of URI doesn't exist: 'package:flutter_riverpod/flutter_riverpod.dart' - flutter

I am now compile my project but shows this error:
Target of URI doesn't exist: 'package:flutter_riverpod/flutter_riverpod.dart'.
this is my full code:
import 'package:Cruise/src/widgets/CruiseApp.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:Cruise/src/common/history.dart';
import 'package:Cruise/src/common/theme.dart';
import 'package:Cruise/src/common/view_manager.dart';
import 'package:timeago/timeago.dart' as timeago;
class CustomEn extends timeago.EnMessages {
#override
String suffixAgo() => '';
String minutes(int minutes) => '${minutes}m';
String hours(int hours) => '${hours}h';
String days(int days) => '${days}d';
}
void main() async{
WidgetsFlutterBinding.ensureInitialized();
timeago.setLocaleMessages('en', CustomEn());
await HistoryManager.init();
SharedPreferences pref = await SharedPreferences.getInstance();
String themeName = pref.getString('theme');
final theme = ThemeManager.fromThemeName(themeName);
String viewName = pref.getString('view');
final view = ViewManager.fromViewName(viewName);
runApp(ProviderScope(child: CruiseApp(theme: theme, view: view)));
}
and this is pubspec.yaml:
name: Cruise
description: A article read 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
flutter_localizations:
sdk: flutter
flutter_gallery: ^2.4.0+20400
rally_assets: ^2.0.0
meta: ^1.1.8
scoped_model: ^1.1.0
shrine_images: ^1.1.2
flare_dart: ^2.3.4
flare_flutter: ^2.0.2
vector_math: ^2.0.8
collection: ^1.14.0
flutter_gallery_assets: ^0.2.6
package_info: ^0.4.0
google_fonts: ^1.0.0
flutter_staggered_grid_view: ^0.3.0
provider: ^4.3.2
adaptive_breakpoints: ^0.0.2
cupertino_icons: ^0.1.3
hooks_riverpod: ^0.5.1
http: ^0.12.0+2
flutter_icons: ^1.0.0
timeago: ^2.0.26
animations: ^1.1.2
flutter_hooks: ^0.12.0
share: ^0.6.4+3
shimmer: ^1.1.1
url_launcher: ^5.5.0
uni_links: ^0.4.0
flutter_html: ^1.0.0
shared_preferences: ^0.5.8
state_notifier: ^0.5.0
flutter_secure_storage: ^3.3.3
flutter_slidable: "^0.5.5"
hive: ^1.4.1+1
pull_to_refresh: ^1.6.1
intl_phone_number_input: ^0.5.2+2
dio: 3.0.10
intl: ^0.16.0
flutter_localized_locales: ^1.1.1
hive_flutter:
git:
url: https://github.com/hivedb/hive.git
path: hive_flutter
dev_dependencies:
intl_translation: ^0.17.9
flutter_test:
sdk: flutter
flutter_driver:
sdk: flutter
test:
path:
args:
grinder: ^0.8.0
pedantic: ^1.9.0
string_scanner: ^1.0.5
# 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
generate: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# 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
this is what I have tried:
invalidate android studio cache and restart
run command flutter clean
run flutter packages get
run flutter packages upgrade
flutter pub cache repair
but still not work, what is the reason and what should I do to make it work? this is the env info:
~/source/third-party/Cruise/ios on  master! ⌚ 23:44:37
$ ~/apps/flutter/bin/flutter --version
Flutter 1.24.0-4.0.pre.165 • channel master • https://github.com/flutter/flutter.git
Framework • revision e444b1e3fa (11 hours ago) • 2020-10-30 00:41:52 -0400
Engine • revision 99cc50dfff
Tools • Dart 2.11.0 (build 2.11.0-266.0.dev)
(base)
the logs output:
import 'package:flutter_riverpod/flutter_riverpod.dart';
^
lib/src/widgets/CruiseApp.dart:4:8: Error: Error when reading '../../../.pub-cache/hosted/mirrors.tuna.tsinghua.edu.cnGdart-pub/flutter_riverpod-0.5.1/lib/flutter_riverpod.dart': No such file or directory
import 'package:flutter_riverpod/flutter_riverpod.dart';
I rename the ~/.pub-cache/hosted/ mirrir name, now I could successful compile in command line, but when I compile using android studio, shows like this :
what should I do to add cache path into my project?

you have
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
If you are using hooks, use hooks_riverpod, if not, use flutter_riverpod. I don't see a reason why you should be using both of them.
Also, the error makes sense, because you don't have flutter_riverpod in package.yaml

Related

how to resolve this problem in flutter.bat i don't understand anything

Error: No named parameter with the name 'nullOk'.
../…/src/extended_image.dart:786
_invertColors = MediaQuery.of(context, nullOk: true)?.invertColors ??
^^^^^^
: Context: Found this candidate, but the arguments don't match.
../…/widgets/media_query.dart:818
static MediaQueryData of(BuildContext context) {
^^
2
FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 59s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
name: pubx
description: A new Flutter project.
# 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.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: ^0.17.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
auto_size_text: ^3.0.0
pixel_perfect: ^1.1.1
get: 4.5.1
extended_image: ^2.0.0
like_button: ^2.0.5
fluttericon: ^2.0.0
google_nav_bar: ^5.0.6
flutter_switch: ^0.0.2
story_view: ^0.12.8
share: ^2.0.4
flutter_share: ^2.0.0
flutter_native_splash: ^0.3.2
google_fonts: ^1.1.2
get_storage: ^1.2.1
flutter_secure_storage: ^4.2.1
image_cropper: ^1.5.1
cached_network_image: ^2.5.1
connectivity_plus: ^0.8.1
sqflite: ^2.0.2
path_provider: ^1.6.28
path: ^1.8.0
equatable: ^2.0.5
#flutter_bloc: ^7.1.0
intl_phone_number_input: ^0.1.2
vibration: ^1.7.6
sound_mode: ^2.0.2
flutter_facebook_auth: ^2.0.2+1
#flutter_facebook_auth: ^3.0.0-nullsafety.0
google_sign_in: ^5.1.0
http: ^0.12.2
#firebase_auth: ^0.16.1
#firebase_core: ^0.4.4
dev_dependencies:
flutter_test:
sdk: flutter
dio: ^3.0.10
jwt_decode:
flutter_spinkit: any
image_picker: ^0.6.7+6
image_gallery_saver: any
# image_picker: any
provider: ^5.0.0
permission_handler: any
shared_preferences: any
shimmer: ^2.0.0
# flutter_local_notifications: any
font_awesome_flutter: ^9.1.0
#keyboard_actions: any
# flutter_3d_choice_chip: ^0.1.4
# Shared_preferences: ^0.5.7+1
# firebase_messagering: ^6.0.13
flutter_local_notifications: ^1.4.3
# cached_network_image: ^2.1.0+1
# image_cropper: ^1.2.1
# photo_view: ^0.9.2
# url_launcher: ^5.4.10
# video_thumbnail: ^0.5.0
keyboard_actions: any
# flutter_3d_choice_chip: ^0.1.4
# Shared_preferences: ^0.5.7+1
# firebase_messagering: ^6.0.13
#flutter_local_notifications: ^1.4.3
# cached_network_image: ^2.1.0+1
# image_cropper: ^1.2.1
# photo_view: ^0.9.2
# url_launcher: ^5.4.10
# video_thumbnail: ^0.5.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
flutter_native_splash:
color: "#ffffff"
color_dark: "#272727"
image: 'assets/images/logo-PubX-Mobile.png'
image_dark: 'assets/images/logo-PubX-Mobile.png'
android_12:
image: 'assets/images/logo-PubX-Mobile.png'
icon_background_color: "#ffffff"
image_dark: 'assets/images/logo-PubX-Mobile.png'
icon_background_color_dark: "#272727"
# 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.
generate: true
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/
- assets/images/photos/
# 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

flutter location package version conflict with google_map_location_picker

I download a source code from codecanyone but
I am facing the following issue when adding google_map_location_picker package
Because location 4.3.0 depends on location_platform_interface ^2.3.0 and no versions of location_platform_interface match >2.3.0 <3.0.0, location 4.3.0 requires location_platform_interface 2.3.0.
And because location_platform_interface 2.3.0 depends on plugin_platform_interface ^2.0.0 and geolocator_platform_interface <2.0.0-nullsafety.0 depends on plugin_platform_interface ^1.0.2, location 4.3.0 is incompatible with geolocator_platform_interface <2.0.0-nullsafety.0.
And because google_map_location_picker >=4.1.3 depends on geolocator ^6.1.14 which depends on geolocator_platform_interface ^1.0.8, location 4.3.0 is incompatible with google_map_location_picker >=4.1.3.
So, because markets depends on both google_map_location_picker 4.1.7 and location 4.3.0, version solving failed.
pub get failed (1; So, because markets depends on both google_map_location_picker 4.1.7 and location 4.3.0, version solving failed.)
here is my pubspec.yaml file
name: markets
description: markets
# 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: 2.2.0
environment:
sdk: ">=2.2.2 <3.0.0"
module:
androidX: true
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.4
google_maps_flutter: 2.1.1
google_map_location_picker: 4.1.7
mvc_pattern: 6.6.4+2
global_configuration: 2.0.0-nullsafety.1
html: 0.15.0
shared_preferences: 2.0.13
flutter_html: 3.0.0-alpha.2
flutter_svg: 1.0.3
location: 4.3.0
webview_flutter: 3.0.0
url_launcher: 6.0.20
cached_network_image: 3.2.0
fluttertoast: 8.0.8
flutter_staggered_grid_view: 0.4.0-nullsafety.3
intl_utils: 2.6.1
carousel_slider: 4.0.0
cloud_firestore: 3.1.8
firebase_auth: 3.3.7
firebase_core: 1.12.0
firebase_messaging: 11.2.6
firebase_storage: 8.0.0
image_picker: 0.7.5+4
string_validator: 0.3.0
platform: 3.1.0
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:
- assets/cfg/
- assets/img/
# 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: ProductSans
fonts:
- asset: assets/fonts/ProductSans-Thin.ttf
weight: 100
- asset: assets/fonts/ProductSans-Thin.ttf
weight: 200
- asset: assets/fonts/ProductSans-Light.ttf
weight: 300
- asset: assets/fonts/ProductSans-Regular.ttf
weight: 400
- asset: assets/fonts/ProductSans-Medium.ttf
weight: 500
- asset: assets/fonts/ProductSans-Bold.ttf
weight: 600
- asset: assets/fonts/ProductSans-Black.ttf
weight: 700
- asset: assets/fonts/ProductSans-Black.ttf
weight: 800
- asset: assets/fonts/ProductSans-Black.ttf
weight: 900
# - family: Trajan Pro
# fonts:
# - asset: assets/fonts/TrajanPro.ttf
# - asset: assets/fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-assets/fonts/#from-packages
flutter_intl:
enabled: true
You've just stumbled upon a Dependency Hell. google_map_location_picker is pretty old now (16 months already) and it uses outdated versions of other packages that some dependencies from the pubspec.yaml depends on itself.
If you remove google_map_location_picker from the dependencies everything installs smoothly. Your best option then would be to fork google_map_location_picker and change the dependencies yourself and point its dependency in the pubspec.yaml to this fork of yours.
To add the fork as a dependency, for example from Github, do something like this:
dependencies:
flutter:
sdk: flutter
carousel_pro:
git:
url: git://github.com/your_account/google_map_location_picker_fork.git
ref: main # branch name

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_whatsapp depends on both integration_test ^1.0.2+3 and flutter_driver any from sdk, version solving failed

Because every version of flutter_driver from sdk depends on vm_service 7.3.0 and integration_test 1.0.2+3 depends on vm_service >=4.2.0 <7.0.0, flutter_driver from sdk is incompatible with integration_test 1.0.2+3.
And because no versions of integration_test match >1.0.2+3 <2.0.0, flutter_driver from sdk is incompatible with integration_test ^1.0.2+3.
So, because flutter_whatsapp depends on both integration_test ^1.0.2+3 and flutter_driver any from sdk, version solving failed.
Running "flutter pub get" in flutter_whatsapp...
pub get failed (1; So, because flutter_whatsapp depends on both integration_test ^1.0.2+3 and flutter_driver any from sdk, version solving
failed.)
Am getting this kinda error
Thanks in advance...
name: flutter_whatsapp
description: A new Flutter project.
# 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.3
ext_storage: ^1.0.3
intl: ^0.17.0
http: ^0.13.4
contacts_service: ^0.6.3
cached_network_image: ^3.1.0
camera: ^0.9.4+3
# video_player: ^0.10.0+5
path_provider: ^2.0.6
fluro: ^2.0.3
sliding_up_panel: ^2.0.0+1
flutter_app_badger: ^1.3.0
url_launcher: ^6.0.12
shared_preferences: ^2.0.8
android_intent: ^0.3.7+6
permission_handler: ^8.2.5
integration_test: ^1.0.2+3
uuid: ^3.0.5
# fast_qr_reader_view: ^0.1.5
# fast_qr_reader_view:
# git:
# url: git://github.com/facundomedica/fast_qr_reader_view.git
dev_dependencies:
flutter_driver:
sdk: flutter
flutter_test:
sdk: flutter
version: any
# test: ^1.5.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
# 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

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.