I tried updating dart and now wall the lines are red - flutter

I can't seem to post an image yet but my entire main.dart is red including the 'package:flutter/material.dart' and other widgets.

Try flutter clean and then flutter pub get.
If that doesn't work, you can try upgrading your Flutter SDK (again?) like so: flutter upgrade.
You can also run flutter doctor to see a list of possible issues with your code.

Related

How to remove or change flutter_native_splash?

I use flutter_native_splash: ^2.1.2+1.
I wanted to set white background color, but I set a different color.
I called flutter pub run flutter_native_splash:create twice.
First time, with the other color. Second time with white.
So, splash pops up two times.
Has flutter_native_splash deleted or changed commands?
I had the same problem, it seems it is caused by Springboard caching LaunchStoryboard.storyboard's images.
My problem was solved by doing this:
Delete your app from the device
Restart the device, re-install and launch the app.
Try with remove and clean ;)
flutter clean
flutter pub get
flutter pub run flutter_native_splash:remove
flutter clean
flutter pub get
flutter pub run flutter_native_splash:create

Flutter (2.5) - A splash screen was provided to Flutter, but this is deprecated

I am new to flutter and recently tried to develop a test app for learning sake with latest version Flutter 2.5. By looking at some tutorial online, I have added flutter_native_splash: ^1.2.3 package for splash screen. And works fine.
However, when I launch app for the first time, it shows following debug message
W/FlutterActivityAndFragmentDelegate(18569): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
After visiting the above link, I am not able to understand much what is supposed to be done.
Code in pubspec.yaml
flutter_native_splash:
color: "#FFFFFF"
color_dark: "#000000"
image: assets/images/splash_720.png
android: true
ios: true
android12: true
Also, compileSdkVersion and targetSdkVersion is set to 31 in build.gradle
Please help. Thanks in advance.
To avoid that warning you just need to remove that API usage from your project.
Remove these lines of code from the AndroidManifest.xml file.
Previously, Android Flutter apps would either set io.flutter.embedding.android.SplashScreenDrawable in their application manifest, or implement provideSplashScreen within their Flutter Activity. This would be shown momentarily in between the time after the Android launch screen is shown and when Flutter has drawn the first frame. This is no longer needed and is deprecated – Flutter now automatically keeps the Android launch screen displayed until Flutter has drawn the first frame. Developers should instead remove the usage of these APIs. - source
UPDATE (FLUTTER 2.8.0)
As per the flutter 2.8.0 update, The newly created project doesn't have this warning.
They removed unused API from Androidmanifest.yml but still have belove mentioned code.
Remove the below lines from the android manifest file. It's no longer used
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"/>
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"/>

"The named parameter keyboardDismissBehavior isn't defined" without pull_to_refresh

As the title, I got a error message that the singleChildScrollView does not has keyboardDismissBehavior property. Some articles said that this issue is caused by the version of pull_to_refresh package. But I didn't use that package in my project. Please help.
Code Image
According to Flutter docs, the keyboardDismissBehavior parameter is only available in Flutter after v2.2.0:
76312 add keyboardDismissBehavior into SingleChildScrollView (cla: yes, f: scrolling, framework, waiting for tree to go green)
To fix this, just upgrade your Flutter:
flutter upgrade

Custom Flutter Android FirebaseMessagingService

I'm trying to make a custom FirebaseMessagingService in Android for Flutter to execute Kotlin code on receiving a notification in the background. Does anyone have an example of how this can be done while still receiving the notification/message.data in the main flutter app?
Thanks!
I ended up creating a custom flutter plugin that is run in the background using the FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);

Is runApp() method necessary to create a flutter app?

dart code
I expected this code to paint a black colored rectangle to screen but it didn't .I'm using flutter framework and I want to know that don't flutter support making apps like these or any mistake in my code. I just
wanted to make run flutter code without built-in flutter framework library
}
Yes, it's necessary. In dart only execute code inside the main method. Not like JavaScript or Python. It's like java/c. The only execution is the main method.