How to solve 'could not find package integration_test in the Flutter SDK' error - flutter

I have an app, it is very simple and I keep getting this error:
pub get failed (server unavailable) -- attempting retry 1 in 1
second... Because bascis depends on integration_test any from sdk
which doesn't exist (could not find package integration_test in the
Flutter SDK), version solving failed.
I have tried
Pup upgrade, Pub get.
How can I get rid of this error?

I had the same error after changing my channel from master to stable. I was able to fix it by removing (or commenting out) the following library from pubspec.yaml
dev_dependencies:
# integration_test:
# sdk: flutter

I experienced this when I was trying to setup a flutter web project without enabling flutter web on my PC. I enabled flutter for web and everything was okay.

For me had to comment out sdk part like so:
dev_dependencies:
integration_test:
# sdk: flutter

It is likely due to your network problem. Because the output says (server unavailable).
Ways to debug this:
Try curl https://google.com to see whether your command line can connect to network.
Also try, for example, curl https://flutter.dev (or, try to curl the actual url your pub get is trying to access.
This may due to, for example, your network is broken. Or because you have a broken VPN, broken proxy, etc.

Related

Flutter Web cloud_firestore package: Versions newer than 0.12.11 produces just a blank web page

When I run the command: flutter build web => I get a blank web page. If I use cloud_firestore::0.12.11 OR older, all runs perfectly well.
Steps to reproduce the behavior:
flutter doctor. No issues found.
flutter run -d chrome. The app runs OK on the local browser.
flutter build web. The app runs and shows a blank page.
In pubspec.yaml: remove the dependency cloud_firestore: The app runs OK.
In pubspec.yaml: add the dependency cloud_firestore:0.12.11 (older version), The app runs OK.
Expected behavior
I need to use cloud_firestore: 0.14.0+2 so I can use the data type FirebaseFirestore.
Are you also using other firebase packages? I have found there are issues with firebase_auth - including a black screen.
Make sure you following the Migration Guide: https://firebase.flutter.dev/docs/migration/#plugin-changes
The issue was with a bug in the library itself.

flutter has a problem with redux dependencies

i have a problem to run my flutter app, it seems flutter doesn't recognize it. i tried to connect to internet while running the project but the problem remains the same, here is the error message:
and here is the code where i inserted the dependency :
dependencies:
redux: ^4.0.0
flutter_redux: ^0.6.0
Your package name is likely also redux according to this Github issue. You'll have to change your package name to something other than redux and you should be able to flutter pub get.
this error was caused by the fact that i named my app REDUX, i changed it and it works now.

Flutter Gradle build with error exception

i just setup my android studio and vs code and flutter SDK installed but any time i try running the project i get this Gradle error, i cant figure out what the problem is please help me out.
After running the flutter doctor everything seems to be okay.
the problem might be caused by many factors so lets try some solutions
after each one rebuild your app if the error message changed or the problem solved please keep us informed
run these commands one by one
flutter channel stable
flutter upgrade --force
flutter pub cache repair
cd your app folder
flutter clean
edit app/build.gradle in your host app such as it includes the local repo
like in here
repositories {
maven {
url 'https://storage.googleapis.com/download.flutter.io'
}
}
use VPN and rebuild your app

Error: This requires the 'non-nullable' experiment to be enabled

I am playing around with non-nullable types and added this to my analysis_options.yaml:
analyzer:
enable-experiment:
- non-nullable
I have a code-generator that is utilising the nullability extension. Visual Code is fine with my code.
Now, I try to run:
flutter packages pub run build_runner watch
I get this error message:
[SEVERE] Failed to snapshot build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.
[SEVERE] xyz.dart:95:7: Error: This requires the 'non-nullable' experiment to be enabled.Try enabling this experiment by adding it to the command line when compiling and running.
How can I pass --enable-experiment:non-nullable to flutter packages pub run?
The same happens if I run:
flutter build ios
I get the error message:
lib/main.dart:61:26: Error: This requires the 'non-nullable' experiment to be enabled.
Try enabling this experiment by adding it to the command line when compiling and running.
So, same question: How can I pass --enable-experiment:non-nullable to flutter build?
This problem was occured for me after upgrading the Flutter.
I solved it by cleaning and upgrading the project dependencies again.
Run the below commands in the root directory of your project:
flutter clean
flutter packages pub upgrade
flutter pub run build_runner build
Also as others said, please make sure your sdk version in the pubspec.yaml is compatible with your flutter sdk version.
For null safety to work,
environment:
sdk: ">=2.12.0 <3.0.0"
should be this version at least.
then run flutter clean
and flutter pub get it will work.
Try
flutter clean
This is worked for me!
Depending on what you're doing, sometimes it's as simple as changing the environment in your pubspec.yaml file to update the lower end, ie change a lower end like
environment:
sdk: ">=2.0.0 <3.0.0"
to
environment:
sdk: ">=2.6.0 <3.0.0"
or
environment:
sdk: ">=2.7.0 <3.0.0"
This has worked for the various things that cause this error (using spread syntax in latest version of flutter and dart will also cause this), but I don't need the older environments.
A simple fix for me was to ensure that the analysis_options.yaml is in
the root folder. In my case, it was in the lib folder and none of the
experimental features worked until I moved the file to the same folder
as pubspec.yaml. Other things that can happen include updates that
make the experimental feature no longer required so updating to the
latest version on the flutter master channel may be useful in addition
to verifying the file location. Haven't been able to get the command line
running with this option, however.
Dart Reference
Example of Analysis Options File

Usage of Websocket, STOMP in flutter application

While trying to work with STOMP, websockets, facing issue for "packages get" after updating pubspec with required stomp/websocket details. I have tried for stomp, stompdart, websocket none of them worked.
Error observed while running "packages get" is
"The current Dart SDK version is 2.1.0-dev.4.0.flutter-4eb879133a.
Because project_name depends on stompdart >=0.0.2 which requires SDK version >=1.5.0 <2.0.0, version solving failed.
pub upgrade failed (1)"
If I try to downgrade flutter version then it has thrown exception informing 'current project needs SDK version > 2.0.0
Please help to clear the issue or suggest some other way as I am using STOMP at server end.
had the same issue, it can be solved in two ways:
solved it by adding this to my yaml file :
dependency_overrides:
stomp: ^0.7.3
dependencies:
stomp: ^0.7.3
flutter:
sdk: flutter
using the dependency_overrides works.
Secondly by running "pub upgrade" in your project directory
https://github.com/rikulo/stomp/issues/18#issuecomment-435748215
Well, this is not a definitive answer, but it may help you.
I forked a chinese library that seems to work named JStomp and did some translations. Let me know if it work since I am also interested to be able to work with STOMP on Flutter.
Here's my fork: https://github.com/raedcran/flutter_jstomp