every version of flutter_test from sdk depends on test_api 0.4.8, mockito >=4.1.2 <=5.0.0-nullsafety.7 is incompatible with flutter_test from sdk - flutter

pubspec.yaml:
name: my_chat_app
description: A new Flutter application.
# 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
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
chat:
path: ./chat
sqflite: ^2.0.0+3
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
mockito: ^4.1.4
flutter_lints: ^1.0.0
# The following section is specific to Flutter.
flutter:
chat/pubspec.yaml:
name: chat
description: A new Flutter package project.
environment:
sdk: ">=2.16.1 <3.0.0"
flutter: ">=1.17.0"
dependencies:
flutter:
sdk: flutter
rethinkdb_dart: ^2.3.2+6
encrypt: ^4.0.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
flutter:
flutter pub get output in pubspec.yaml:
Running "flutter pub get" in my_chat_app...
Because mockito >=4.1.2 <=5.0.0-nullsafety.7 depends on test_api ^0.2.19-nullsafety and every version of flutter_test from sdk depends on test_api 0.4.8, mockito >=4.1.2 <=5.0.0-nullsafety.7 is incompatible with flutter_test from sdk.
So, because my_chat_app depends on both flutter_test from sdk and mockito ^4.1.4, version solving failed.
pub get failed (1; So, because my_chat_app depends on both flutter_test from sdk and mockito ^4.1.4, version solving failed.)
Process finished with exit code 1

Related

Why does Flutter shared_preferences download an older version without null safety?

I'm trying to add shared_preferences to a Flutter project. By default, version 0.5.7+3 is downloaded which isn't null safe.
Adding the latest version, 2.0.15, gets the following error:
Running "flutter pub get" in platform...
Because shared_preferences >=2.0.10 depends on shared_preferences_windows ^2.0.1 which depends on path_provider_platform_interface ^2.0.0, shared_preferences >=2.0.10 requires path_provider_platform_interface ^2.0.0.
And because path_provider_platform_interface >=2.0.0 depends on platform ^3.0.0, shared_preferences >=2.0.10 requires platform ^3.0.0.
So, because platform depends on shared_preferences ^2.0.15 and platform is 1.0.0+1, version solving failed.
pub get failed (1; So, because platform depends on shared_preferences ^2.0.15 and platform is 1.0.0+1, version solving failed.)
exit code 1
The platform version is actually the version number in the pubspec.yaml. Changing the version number to 3.0.0 downloads 2.0.15 of shared_preferences but then fails on running:
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
lib/main.dart:1
Building with Flutter multidex support enabled.
: Error: Error when reading 'lib/platform.dart': No such file or directory
../…/src/method_channel_path_provider.dart:7
import 'package:platform/platform.dart';
^
: Error: Error when reading 'lib/platform.dart': No such file or directory
../…/interface/common.dart:8
import 'package:platform/platform.dart';
pubspec.yaml is:
name: platform
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.7.0 <3.3.3'
dependencies:
flutter:
sdk: flutter
firebase_core:
firebase_auth:
google_sign_in:
firebase_analytics:
font_awesome_flutter:
provider:
shared_preferences:
config:
path: config
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
assets:
- assets/images/
uses-material-design: true
How can I add a null safe version of shared_preferences to my project?
Why is the pubspec.yaml version number being read as platform version?
The problem turned out to be the platform name in the pubspec.yaml.
This pubspec.yaml
name: platform
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.18.2 <3.0.0'
dependencies:
shared_preferences:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
resolves to version 0.5.7+3 of shared_preferences:
Package Name Current Upgradable Resolvable Latest
direct dependencies:
shared_preferences *0.5.7+3 *0.5.7+3 *0.5.7+3 2.0.15
Changing the pubspec.yaml name field to something different:
name: notplatform
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.18.2 <3.0.0'
dependencies:
shared_preferences:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
means shared_preferences is updated when flutter pub upgrade is run
shared_preferences 2.0.15 (was 0.5.7+3)

Dart SDK version mismatch

version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
hive: ^1.0.0
hive_flutter: ^0.2.1
path_provider: ^1.3.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
dev_dependencies:
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
build_runner: ^2.1.1
hive_generator: ^0.5.1
pub get failed (1; Because depends on path_provider >=2.0.0 which requires SDK version >=2.12.0-259.9.beta <3.0.0, version solving failed.)
exit code 1
how to fix it?
Hi #Sreerekha and welcome to StackOverflow!
cupertino_icons: ^1.0.2 has null-safety enabled, so you have to:
upgrade your SDK to version 2.12 (or higher) and migrate all your app to null-safety,
or you have to downgrade the version of this dependency.
Unfortunately, you can't have the best of both worlds
How_to_migrate_to_null_safety
Cupertino_icons_versions

flutter packages get command gives an error error

hello I tried running flutter pub get and I was faced with this error:
flutter pub get
Waiting for another flutter command to release the startup lock...
Running "flutter pub get" in Deutsche-Flutter...
Because every version of flutter_test from sdk depends on test_api 0.3.0 and mockito 4.1.4 depends on test_api ^0.2.19-nullsafety, flutter_test from sdk is incompatible with mockito 4.1.4.
And because no versions of mockito match >4.1.4 <5.0.0, flutter_test from sdk is incompatible with mockito ^4.1.4.
So, because deutsche depends on both mockito ^4.1.4 and flutter_test any from sdk, version solving failed.
pub get failed (1; So, because deutsche depends on both mockito ^4.1.4 and flutter_test any from sdk, version solving failed.)
exit code 1
I already ran flutter upgrade and tried to run flutter pub get here are my dependencies:
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.0
flutter_svg: ^0.19.1
flutter_bloc: ^6.1.2
get: ^3.23.1
rxdart: ^0.19.0
http: ^0.12.2
google_fonts: ^0.3.9
circular_countdown_timer: ^0.1.0
pin_code_fields: ^2.4.0
google_nav_bar: ^3.2.0
line_icons: ^0.2.0
shared_preferences: ^0.5.12+4
flutter_launcher_icons: ^0.7.2+1
rive: ^0.6.8
timer_count_down: ^1.0.4+1
logger: ^0.9.4
dartz: ^0.9.0-dev.6
freezed_annotation: ^0.12.0
bloc_test: ^7.1.0
mockito: ^4.1.4
jwt_decode: ^0.3.1
carousel_slider: ^3.0.0
dev_dependencies:
build_runner:
freezed: ^0.12.7
flutter_test:
sdk: flutter
Update all of your plugins and that will work. And do make sure that all of them are null-safety enabled.
try replacing mokito version as any as follows.
mockito: any
then check the pubspeck.lock file and search mokito and take that version number from there and replace it in pubspec.yaml file
update the mockito package to => mockito: ^5.2.0

Flutter - pub get error, when getting versions of path_provider

I'm migrating from flutter 1 to flutter 2, and when I updated my packages from pubspec.yaml, I received this error:
Because path_provider >=1.6.4 <2.0.0-nullsafety depends on path_provider_platform_interface ^1.0.1 which depends on plugin_platform_interface ^1.0.1, path_provider >=1.6.4 <2.0.0-nullsafety requires plugin_platform_interface ^1.0.1.
And because firebase_messaging >=9.0.0 depends on firebase_core_platform_interface ^4.0.0 which depends on plugin_platform_interface ^2.0.0, path_provider >=1.6.4 <2.0.0-nullsafety is incompatible with firebase_messaging >=9.0.0.
So, because myApp depends on both firebase_messaging ^9.1.1 and path_provider ^1.6.5, version solving failed.
Running "flutter pub get" in myApp...
pub get failed (1; So, because myApp depends on both firebase_messaging ^9.1.1 and path_provider
^1.6.5, version solving failed.)
My pubspec.yaml archive:
version: 1.0.0+1
environment:
sdk: ">=2.2.2-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cupertino_icons: ^0.1.3
path_provider: ^1.6.5
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
You should try out with null safety
path_provider:
without version.

Because every version of flutter_driver from sdk depends on crypto 3.0.0 and Cruise depends on crypto 2.1.3, flutter_driver from sdk is forbidden

When I compile my project, it shows this error:
Running "flutter pub get" in cruise-open...
Because every version of flutter_driver from sdk depends on crypto 3.0.0 and Cruise depends on crypto 2.1.3, flutter_driver from sdk is forbidden.
So, because Cruise depends on flutter_driver any from sdk, version solving failed.
pub get failed (1; So, because Cruise depends on flutter_driver any from sdk, version solving failed.)
I have tried each version of crypto but still not fix my problem, what should I do to solve it? This is my pubspec.yaml:
name: Cruise
description: A RSS article read Flutter application.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: 0.16.1
meta: ^1.1.8
flutter_svg: 0.19.0
logger: 0.9.4
marquee: ^1.7.0
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
package_info: ^0.4.0
fluttertoast: 7.1.6
google_fonts: 1.0.0
flutter_staggered_grid_view: ^0.3.0
adaptive_breakpoints: ^0.0.2
cupertino_icons: 1.0.0
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
crypto: 2.1.3
url_launcher: 5.5.0
uni_links: 0.4.0
flutter_html: 1.2.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
#fluwx: ^2.4.1
pull_to_refresh: 1.6.3
intl_phone_number_input: ^0.5.0
dio: 3.0.10
fish_redux: 0.3.4
hive_flutter:
git:
url: https://github.com/hivedb/hive.git
path: hive_flutter
dev_dependencies:
flutter_test:
sdk: flutter
flutter_driver:
sdk: flutter
test:
path:
args:
grinder: ^0.8.0
pedantic: ^1.9.0
string_scanner: ^1.0.5
# 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
The problem lies here crypto: 2.1.3. You need to update it to the latest version i. e. crypto: ^3.0.0.
This should solve your issue.
What happens is that when you use so many packages, some of those packages use some other packages. It may so happen that two or more packages use the same package.
In your case, the package flutter_driver uses the package crypto. And you yourself are using the package crypto but a different version of it. So, it creates an error because you cannot have two different versions of the same package.