'Size' is imported from both 'dart:ffi' and 'dart:ui' Flutter 3 - flutter

After upgrading my flutter from 2.10.5 to 3.0.0, I have those errors on my android studio and the project don't build anymore on windows 10.
How can I solve this problems.
Thanks
'Size' is imported from both 'dart:ffi' and 'dart:ui'.

bitsdojo_window package seems to have issues when Flutter 3 was introduced. One of possible ways is to run this command on your terminal
dart fix --apply
and
flutter pub upgrade

This happens because of Flutter 3.0. This package needs to get updated for Flutter 3.0
check This Link for the answer it requires an update which the developer said he's working on it

Related

The getter 'outlineVariant' isn't defined for the class 'Scheme'

Earlier, I was using flutter 3.4, and My project compiled successfully. Recently, We've migrated to flutter 3.7 and I am getting the below error.
error: [+1994 ms] ../../../../../../development/flutter/packages/flutter/lib/src/material/color_scheme.dart:237:54: Error: The getter 'outlineVariant' isn't defined for the class 'Scheme'.
The issue happens due to the latest flutter version upgrade. I fixed the issue by downgrading the flutter version to flutter 3.4 instead of flutter 3.7
For me doing flutter clean and then flutter pub get solved the problem.

Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?'

how can I fix this error in flutter with android studio
/C:/src/flutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.3/lib/get_navigation/src/snackbar/snackbar.dart:452:31: Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null.
'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/src/flutterSDK/flutter/packages/flutter/lib/src/scheduler/binding.dart').
Try calling using ?. instead.
SchedulerBinding.instance.addPostFrameCallback(
^^^^^^^^^^^^^^^^^^^^
This error happens because the package get 4.6.2 or 4.6.3 is for new flutter sdk version 3.0. So you got this error. you have to use get 4.6.1 for fluter SDK version 2.xx
I had the same problem.. on "dart.get" package. Then I did this..
First go to pubspec.yaml file then edit the get version not more than
(get: ^4.6.1).. if you are using fluter sdk v2.xx.
if the version won't get lower then try this method
go to pubspec.lock file. edit the version not more than (4.6.1).. if you are using fluter sdk v2.xx.
you will find in pubspec.lock file
and last you have to do this
then "pub get" .. error will be gone.
This is because of recent flutter updates. All flutter SDKs >= V2.10.3 have this issue. There's no proper solution for this error yet.
Temporary Solution:
You can simply downgrade your flutter SDK to V2.10.2 or lower to get rid of this issue.
Note:
After downgrading, make sure you also change the dart version in pubspec.yaml of your flutter project according to the Flutter SDK.
This error is due to some changes happened in null-safety properties in Flutter 3.0.0. In your case you can try to import:
get: 4.6.1 instead of get: ^4.6.3.
Source: https://github.com/jonataslaw/getx/issues/2356
try this
flutter doctor --android-licenses

Flutter stable version 1.20.1 build failed issue

I update the Flutter latest stable version 1.20.1 when I click the run button on an already existing project it shows me this error:
Could not resolve the package 'characters' in 'package: characters/characters.dart'.
But when I create a new project and try to run it works.
Following the Github issue below, it is a common issue after upgrading to a different Flutter Version
Could not resolve package characters
In my case, I resolved the issue with flutter clean.

Using Futures in flutter old versions

Android studio is giving me this error
info: The class 'Future' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.
If I put this
import 'dart:async';
the problem seems to go away. Could someone explain why this is happening and if this is the correct way to fix this.
Thanks a lot.
---- edit
Can I update dart core to something > 2.1
I am guess it is this line in my pubspec yaml
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
Is there any downsides to doing thins i.e. running on older android/ios versions.
Open the terminal and execute the following:
flutter upgrade
This will upgrade both flutter and dart

Flutter app Error while initializing the Dart VM: Wrong full snapshot version, expected '8343.....' found '46b2....'

flutter app was working getting build and run on Xcode 10 on device iOS 12 fine before,
The time dart upgrade 2.1.0 happen in Flutter build iOS worked well with command and on Xcode 10 after build get success while running Flutter app on iPhone 7 iOS 12, it started giving error and app gets crash with following error message in Xcode logs.
Error is Runner[410:28754] [VERBOSE-3:dart_vm.cc(403)] Error while initializing the Dart VM: Wrong full snapshot version, expected '8343f188ada07642f47c56e518f1307c' found '46b2bfb57b5647c5f7527ff9aa56c69b'
Here are the details of the flutter sdk and dart .
Flutter 0.11.9 • channel beta • https://github.com/flutter/flutter.git
Framework • revision d48e6e4
Engine • revision 5c8147450d
Tools • Dart 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
I have experienced this error and none of the above solution worked for me infact the option of clearing the flutter/bin/cache messed the entire vscode IDE.
So I deleted the entire flutter SDK and installed fresh new SDK from flutter official website.
After this installation everything was working fine.
I had this issue after a flutter upgrade. Uninstalling the app from the device and then flutter running it again solved the problem.
After deleting the flutter/bin/cache and running flutter clean, I couldn't get the dart sdk to load until I launched the flutter console (flutter_console.bat) that can be found in the directory where you installed flutter and ran flutter doctor there. That solved the problem.
Do git clean -xffd in flutter installed directory(repo).
If it's a Flutter project first try flutter clean if did not work, try above git command.
If still not solved, delete everything inside /flutter/bin/cache and try.
If still not :D,
Do flutter channel master, flutter upgrade, and flutter clean. If nothing worked please add a comment below.
If you are in Dart environment out flutter/bin/cach/dart-sdk, you may be not upgraded dart-sdk. This happen to me Dart 2.5.0 with chololate installed. So I just did choco upgrade dart-sdk
I have exactly this problem i Solve it how ?
by these comments you just update flutter
flutter channel beta
,
flutter upgrade
you should upgrade your dart sdk
So try this command :
choco install dart-sdk
if this is not work for you download it from this link
https://dart.dev/tools/sdk/archive;
and replace it with your current dart-sdk in flutter
I also have experienced the same issue. I upgraded the flutter version and later downgraded and encounter this issue maily on IOS adhoc build.
Solution:
Delete out $FLUTTER_HOME/bin/cache and run flutter doctor.
This will solve.
What worked for me was changing channel and upgrading and then changing channel back and upgrading.
I had to remove the flutter SDK folder in my computer completely and redownload the latest one at https://flutter.dev/docs/get-started/install/macos
Then, I ran flutter doctor.
You can find where your flutter folder is by typing which flutter in your terminal.
You don't need to uninstall the whole flutter and set environment path or anything else.
Just downgrade to any version by doing the below commands, suppose my current flutter version is v3.3.8 and I come across this issue then:
Go to flutter sdk-path in the command prompt and checkout to any branch you would like to switch for a moment, like v2.5.0. So,
By doing this you changed your repository from v3.3.8 to v2.5.0
git checkout v2.5.0
You can check previous flutter versions from here
link
Downgrade your flutter version to 2.5.0
flutter downgrade v2.5.0
Then upgrade flutter
flutter upgrade