DualTransitionBuilder is imported from both 'package:flutter/src/widgets/dual_transition_builder.dart' and - flutter

After upgrading to version of Flutter 1.20.x I'm getting the following error when building for both iOS and Android.
../../.pub-cache/hosted/pub.dartlang.org/animations-1.1.0/lib/src/shared_axis_transition.dart:241:12: Error: 'DualTransitionBuilder' is imported from both 'package:flutter/src/widgets/dual_transition_builder.dart' and 'package:animations/src/dual_transition_builder.dart'.
return DualTransitionBuilder(
^^^^^^^^^^^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
I have done a Flutter clean several times, deleted and regenerated the iOS Podfile and manually deleted the flutter_build directory. Every time it regenerates the build with this error.

It's known issue, fixed now. Increase the version to at least 1.1.1 in pubspec.yaml
dependencies:
...
animations: ^1.1.1
and run
flutter pub get

Related

Error 'badge' is being imported from 2 dart sources

Getting this error for build failure:
error build: ../../../development/flutter/.pub-cache/hosted/pub.dev/bubble_bottom_bar-2.0.0/lib/bubble_bottom_bar.dart:195:14: Error: ‘Badge’ is imported from both ‘package:badges/src/badge.dart’ and ‘package:flutter/src/material/badge.dart’.
Using code from https://codecanyon.net/item/flyweb-for-web-to-app-convertor-flutter-admin-panel-v10/26840230
Can anyone suggest where and what needs to be edited to get this issue resolved.
Have tried updating the Flutter with following commands
Flutter clean
Flutter pub get
Have also reinstalled pods for ios and still failing to build on Flutter build ios
Badge is coming from both material and badge package. Flutter material provide by default.
If you wish to use the package one, you can do
import 'package:badges/src/badge.dart' as badge;
Now to use it, call badge.Badge(....

seems no-sound-null-safety parameter not work in flutter 2.2.1

I am upgrade my flutter to version 2.2.1, but it seems --no-sound-null-safety no longer avaliable when build the ios package. I am build the project using this command:
~/apps/flutter/bin/flutter build ios --release --no-codesign --no-sound-null-safety
but the output still tell me some package did not support null safety:
Changing current working directory to: /Users/dolphin/source/cruise-open
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building com.earth.dolphin for device (ios-release)...
Running Xcode build...
Xcode build done. 36.6s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
2 warnings generated.
2 warnings generated.
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
- package:state_notifier
- package:fish_redux
- package:flutter_icons
For solutions, see https://dart.dev/go/unsound-null-safety
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
note: Removed stale file
Encountered error while building for device.
is there any solution with this problem? I am search from flutter issue but no one confirm this problem(https://github.com/flutter/flutter/issues/84199), is it a bug of new version?(Because I am using this command works fine until I upgrade to version 2.2.1). is there other way to pass no-sound-null-safety parameter? I have tried many version and found some version works fine, some version did not works. Maybe a flutter bug.
flutter 2.0.1 works
flutter 2.0.3 works
flutter 2.0.6 works
flutter 2.2.0 not works
flutter 2.2.1 not works
flutter 2.2.2 not works
flutter 2.2.3 not works
seem a bug, will fixed next release:https://github.com/flutter/flutter/pull/84372

"The current configured Flutter SDK is not known to be fully supported. Please update your SDK and restart IntelliJ"

I have a problem that I'm trying to solve since last week, I've been searching about this issue and nothing works. I tried to reinstall the flutter and didn't work aswell. The image below is the first issue I have.
Then I went to "Tools -> Flutter -> Flutter Upgrade" and it shows me this message:
C:\src\flutter\bin\flutter.bat --no-color upgrade
fatal: unterminated line in .git/packed-refs: ...
Building flutter tool...
Running pub upgrade...
ProcessException: Process exited abnormally:
fatal: unterminated line in .git/packed-refs: ...
Command: git fetch --tags
Process finished with exit code 1
And when I tap to "Run 'main.dart'", it shows me this message:
fatal: unterminated line in .git/packed-refs: ...
Building flutter tool...
Running pub upgrade...
Running "flutter pub get" in olx...
The current Flutter SDK version is 0.0.0-unknown.
Because carousel_pro 1.0.0 requires Flutter SDK version >=1.2.0 <2.0.0 and no versions of carousel_pro match >1.0.0 <2.0.0, carousel_pro ^1.0.0 is forbidden.
So, because olx depends on carousel_pro ^1.0.0, version solving failed.
pub get failed (1; So, because olx depends on carousel_pro ^1.0.0, version solving failed.)
What could I do to fix these issues?
(Thanks for listening :)
Here the issue is raised due to Flutter SDK version because it is unknown.
These are some steps that I have followed to solve this problem
Run the following git command into your terminal
=> git clone -b master https://github.com/flutter/flutter.git
(this command will clone a flutter folder which contains latest version of Flutter SDK. get more info about SDK - here)
after cloning, we just need to move cloned folder to our default location of flutter SDK.
In my case path of flutter SDK is as follows(ubuntu) -
=> file:///home/bulbul/snap/flutter/common/flutter
I replaced the last flutter folder with the folder which I have cloned before.
then I ran the "flutter --version" command for getting the version of flutter SDK and it gave me the latest version of flutter SDK and the problem was solved.
It worked for me hopefully It will work for you as well.
Happy learning :)
Use the latest flutter SDK then check if the git is available from the command line using git --version. If it's not available from the command line android studio terminal then add git to system path variable and restart android studio.

Flutter webview_flutter build is failing

I am trying to install webview_flutter plugin but somehow my build is failing every time
Launching lib/main.dart on iPhone 11 Pro in debug mode...
Running Xcode build...
├─Assembling Flutter resources... 10.2s
└─Compiling, linking and signing... 2.1s
Xcode build done.
17.5s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
<path_to_project>ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal
error: module 'webview_flutter' not found
#import webview_flutter;
~~~~~~~^~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro.
pubspec.yml
dependencies:
flutter:
sdk: flutter
webview_flutter: ^0.3.19+8
I tried running but it did not solve it.
flutter clean
flutter pub cache repair
Have you follow all the installation for iOS for this plugin?
This is from the webview_flutter page itself:
To use this plugin on iOS you need to opt-in for the embedded views
preview by adding a boolean property to the app's Info.plist file,
with the key io.flutter.embedded_views_preview and the value YES.
This also seems to be related, take a look: https://github.com/flutter/flutter/issues/50190
In my case, the issue was that I had manually edited the podfile to add in my own (non-flutter) pod to the project. However, the flutter build would make no attempt to edit (or overwrite) the podfile, (maybe this is good) so the podfile would not have the changes necessary to support webview_flutter. I figured this all out by creating a brand new flutter project and comparing the new project's generated podfile against my current version. They looked significantly different.
flutter upgrade solved problem for me

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