Images only loading after re-running (Flutter) - iphone

When loading my flutter app on my IOS device in the android developer IDE, the app loads as normal, but images are not loaded onto the app until I click the "Run 'main.dart'" button again. Once my device is disconnected from my computer and I restart the app, the images never load.
The only advice I can find on anything close to this is "Your yaml file must be wrong". I assure you I've checked my pubspec yaml half a million times and cannot find any errors. Besides, the images DO load when the phone is connected to my computer, but only after running the app a second time after it's installed and run the first time. Any help is much appreciated!! My pubspec.yaml file and flutter doctor -v output are below. Thanks again!
PUBSPEC.YAML:
name: billsplitter
description: Split bills easily between your friends!
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
intro_slider: ^2.2.9
flutter:
uses-material-design: true
assets:
- ./images/Welcome to Bill.jpg
- ./images/bill description.jpg
- ./images/bill description2.jpg
- ./images/bill description3.jpg
fonts:
- family: Suez
fonts:
- asset: fonts/SuezOne-Regular.ttf
FLUTTER DOCTOR -V:
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287, locale en-US)
• Flutter version 1.12.13+hotfix.9 at /Users/calebburbach/Documents/development/flutter
• Framework revision f139b11009 (6 weeks ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/calebburbach/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.9.1
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.

Instead of defining each image, you can just provide the folder path like this:
assets:
- images/

Change name of image file in images directory and in pubspec.yaml file like this:
assets:
- images/welcome_to_Bill.jpg
- images/bill_description.jpg
- images/bill_description2.jpg
- images/bill_description3.jpg
Then run this command flutter pub get.

Did you check the initState() function? There might be a missing setState() call in one of the load function.
setState() {
// You can initialize a list here, if you have a list that images use.
}
This solved the issue when I tried adding elements to the list in setState() function while loading.

Related

Flutter Execution failed for task ':app:processDebugManifest'

I am new with Flutter, at first my projects were running good but suddenly I started getting this problem:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module #1f05eb0a
Now whenever I run project or even I tried to make new project I get error like this, I have even tried the available answers related to this query but failed to debug it..
here's my flutter version:
PS C:\Work\t_post> flutter doctor -v
[√] Flutter (Channel stable, 2.2.2, on Microsoft Windows [Version 10.0.19042.1052], locale en-US)
• Flutter version 2.2.2 at C:\Work\flutter
• Framework revision d79295af24 (2 weeks ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\User\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Java\jdk-16.0.1\bin\java
• Java version Java(TM) SE Runtime Environment (build 16.0.1+9-24)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] VS Code (version 1.57.1)
• VS Code at C:\Users\User\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.23.0
[√] Connected device (3 available)
• sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.124
• Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.54
! Doctor found issues in 1 category.
And here's my pubspec.yaml file:
name: t_post
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `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.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# 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
Just downgrading the JDK version from 16 to 15 worked for me.

Flutter auto_route_generator not building, FormatException: Not an instance of List

I'm trying to run Flutter pub run build_runner build,
to generate a router.g.dart file for navigation.
I've run a build_runner clean, a whole project clean then build but no luck.
Im following a tutorial, he just seems to run it exactly with the code I have and its fine. No one else in the comments seem to have this issue and I can't find anything about it online.
It fails saying:
[SEVERE] auto_route_generator:autoRouteGenerator on lib/app/router.dart:
FormatException: Not an instance of List.
[INFO] Running build completed, took 16.2s
[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 48ms
[SEVERE] Failed after 16.3s
pub finished with exit code 1
My router.dart code:
import 'package:auto_route/auto_route_annotations.dart';
import 'package:stacktest/ui/views/covers/cover_view.dart';
import 'package:stacktest/ui/views/home/home_view.dart';
import 'package:stacktest/ui/views/startup/startup_view.dart';
#MaterialAutoRouter()
class $Router {
#initial
StartupView startupViewRoute;
HomeView homeViewRoute;
CoverView coverViewRoute;
}
Pubspec.yaml:
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: ^0.1.3
stacked: ^1.7.1+1
auto_route: 0.6.1
stacked_services: 0.4.4+3
dev_dependencies:
build_runner: 1.10.0
auto_route_generator: 0.6.0
flutter_test:
sdk: flutter
Flutter doctor -v
✓] Flutter (Channel master, 1.20.0-8.0.pre.41, on Mac OS X 10.15.5 19F101, locale en-AU)
• Flutter version 1.20.0-8.0.pre.41 at /Users/mikaelwills/Documents/Flutter
• Framework revision fd80503fd3 (34 hours ago), 2020-07-10 14:41:02 +0530
• Engine revision 9b3e3410f0
• Dart version 2.9.0 (build 2.9.0-20.0.dev 06cb010247)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/mikaelwills/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.8.4
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.47.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.12.2
[✓] Connected device (2 available)
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 83.0.4103.116
• No issues found!
Since the version 0.6.0 there were some breaking changes in the auto_route package, the most important was that It was changed the way routes are declared from class fields to a static list. You can check more details about it here.
So, in order to fix it just update it using a static list as follows:
#MaterialAutoRouter(
routes: <AutoRoute>[
MaterialRoute(page: StartupView, initial: true),
MaterialRoute(page: HomeView),
MaterialRoute(page: CoverView),
],
)
class $Router {}
and then run the build runner command: flutter pub run build_runner watch --delete-conflicting-outputs
Another option could be use an earlier version like the 0.5.0, but it's recommended to keep updated, for more info please check the documentation in theauto route package.

I have an error in vscode when trying to install flame under pubspec.yaml

I'm trying to install flame but whenever I run the pub get it gives me a really long error "Because every version of flutter_test from sdk depends on xml 3.6.1 and tiled >=0.4.0 depends on xml ^4.2.0, flutter_test from sdk is incompatible with tiled >=0.4.0." And then under it is a version solving failed error message.
[√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18363.900], locale en-US)
• Flutter version 1.17.5 at C:\Users\marci\Downloads\flutter
• Framework revision 8af6b2f038 (7 days ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
• Android SDK at C:\Users\marci\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.46.1)
• VS Code at C:\Users\marci\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.12.1
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
name: ggg
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
flame: ^0.24.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
I had the same problem today and checked on the Flame Discord channel.
They told me they have a conflict with their lib with stable flutter channel.
Recommendation is to change to Flutter Channel Beta.
I did that, then did Flutter Upgrade, then finally Flutter Pub Get and it worked.
Terminal Commands
To check which channel you are currently on
Flutter Channel
To change to the beta channel
Flutter Channel Beta
To get the beta version
Flutter Upgrade
So, when I have the same problem with you when I tried it.
Here's my solution:
In your dependencies: section inside the pubspec.yaml file, change the flame section without any version tag:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
flame:

Flutter version solving failed with new flutter upgrade

I have upgraded my flutter recently, previously it was working fine with every package, but now there is one thing which is bothering me right now due to which my project is not running. This is the error happening cos of this package named PURE_MIXPANEL.
ERROR:
The current Dart SDK version is 2.3.1-dev.0.0.flutter-a0290f823c.
Because pure_mixpanel 1.0.7 requires SDK version >=1.19.0 <=2.2.1 and no versions of pure_mi
xpanel match >1.0.7 <2.0.0, pure_mixpanel ^1.0.7 is forbidden.
So, because flutter_app depends on pure_mixpanel ^1.0.7, version solving failed.
Running "flutter packages get" in flutter_app...
pub get failed (1)
From the internet, I have followed so many things like :
flutter upgrade
flutter channel master followed by flutter upgrade
flutter channel dev followed by flutter upgrade
So it upgraded my flutter successfully but it raised one problem that is the package is not at all supported but previously it was working.
Here is my flutter doctor -v result :
[✓] Flutter (Channel master, v1.5.9-pre.193, on Mac OS X 10.14.4 18E226, locale en-US)
• Flutter version 1.5.9-pre.193 at /Users/alok/flutter
• Framework revision 3a6acb8c25 (9 minutes ago), 2019-05-09 09:23:30 -0700
• Engine revision 644db5a49c
• Dart version 2.3.1 (build 2.3.1-dev.0.0 a0290f823c)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/alok/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.0, Build version 10A255
• ios-deploy 1.9.4
• CocoaPods version 1.6.0
[!] Android Studio (version 3.3)
PUBSPEC.YAML:
version: 1.0.0+1
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
pure_mixpanel: ^1.0.7
There is no upgraded version of pure_mixpanel present on the web, and it is important in my project.
Any help would be appreciated. Thanks
Your SDK version is 2.3.1 and SDK for pure_mixpanel is sdk: ">=1.19.0 <=2.2.1"
Check: https://github.com/seenickcode/pure_mixpanel/blob/master/pubspec.yaml
I fix my by adding dart sdk location to env
for Windows
C:\src\flutter\bin\cache\dart-sdk

Flutter After Upgrade can't run application version solving failed

Nope. This answer doesn't work this time for me.
My flutter doctor -v
[✓] Flutter (Channel master, v0.5.9-pre.68, on Linux, locale en_US.UTF-8)
• Flutter version 0.5.9-pre.68 at /home/khophi/.flutterSetup
• Framework revision 5cd97f0004 (2 hours ago), 2018-08-16 14:10:22 -0700
• Engine revision 4ee648914f
• Dart version 2.1.0-dev.0.0.flutter-be6309690f
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /home/khophi/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• ANDROID_HOME = /home/khophi/Android/sdk
• Java binary at: /usr/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
• All Android licenses accepted.
[✗] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
[✓] VS Code (version 1.26.0)
• VS Code at /usr/share/code
• Flutter extension version 2.17.1
[✓] Connected devices (1 available)
• klte • 956e8b90 • android-arm • Android 8.1.0 (API 27)
! Doctor found issues in 1 category.
When I run flutter run, I get:
Running "flutter packages get" in townsquare...
The current Dart SDK version is 2.1.0-dev.0.0.flutter-be6309690f.
Because flutter_circular_chart 0.0.3 requires SDK version >=1.19.0 <2.0.0 and no versions of flutter_circular_chart match >0.0.3 <0.1.0, flutter_circular_chart ^0.0.3 is forbidden.
So, because mobile depends on flutter_circular_chart ^0.0.3, version solving failed.
pub get failed (1)
This is my pubspec.yaml
name: mobile
description: A new Flutter project.
version: 1.0.0+1
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
carousel: ^0.0.1
http: "^0.11.3+16"
validate: "^1.6.0"
url_launcher: "^3.0.2"
shared_preferences: "^0.4.2"
font_awesome_flutter: "^7.0.0"
flutter_circular_chart: "^0.0.3"
flutter_local_notifications: ^0.3.6
dev_dependencies:
flutter_test:
sdk: flutter
assets:
- images/flutter.jpg
- images/logo.png
- images/bg_viewer.jpg
With the above, please enlighten me, what's wrong?
That's is because you are using : Dart version 2.1.0-dev.0.0.flutter-be6309690f and the plugin named flutter_circular_chart has a constraint
https://github.com/xqwzts/flutter_circular_chart/blob/master/pubspec.yaml
environment:
sdk: '>=1.19.0 <2.0.0'
You can fork the project and update the sdk constraint and ref to your repository:
Like this:
flutter_circular_chart:
git: https://github.com/your_repo/flutter_circular_chart.git
Note
Also would be fine if you open an issue in their repo to notify the devs about the issue that you have.
Use devendency_override with same version witch need for same for other dependency.
Like google_maps_flutter: ^0.5.28+1 needs intl to be 0.16.0
then craete dependency_overrides:
intl: ^0.16.0
below of dev_dependencies:
flutter_test:
sdk: flutter
run project until it not run on device.
Enjoy. Thanks..