I recently updated flutter and now a problem seems to occur when I run the project using flutter run.
Indeed, a list of all the errors I had previously is being shown on the screen (which is obviously getting bigger and bigger over time). I tried to recreate a new project and the problem still occurred. Here's an exemple: I didn't include my assets in the pubsec.yml file which obviously triggered an error at first. And now, while it's solved, it still shows on the log. Here it is:
Using hardware rendering with device SM A520F. If you get graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib\main.dart on SM A520F in debug mode...
I/flutter ( 5746): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter ( 5746): The following assertion was thrown resolving an image codec:
I/flutter ( 5746): Unable to load asset: assets/images/image.png
I/flutter ( 5746):
I/flutter ( 5746): When the exception was thrown, this was the stack:
I/flutter ( 5746): #0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
I/flutter ( 5746): <asynchronous suspension>
I/flutter ( 5746): #1 AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:484:44)
I/flutter ( 5746): #2 AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:469:14)
I/flutter ( 5746): #3 ImageProvider.resolve.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:327:17)
I/flutter ( 5746): #4 ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:160:22)
I/flutter ( 5746): #5 ImageProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:325:84)
I/flutter ( 5746): (elided 13 frames from package dart:async)
I/flutter ( 5746):
I/flutter ( 5746): Image provider: AssetImage(bundle: null, name: "assets/images/image.png")
I/flutter ( 5746): Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#00e61(), name: "assets/images/image.png",
I/flutter ( 5746): scale: 1.0)
I/flutter ( 5746): ════════════════════════════════════════════════════════════════════════════════════════════════════
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 11.5s
√ Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk... 16.8s
Syncing files to device SM A520F...
5,175ms (!)
� To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
An Observatory debugger and profiler on SM A520F is available at: http://127.0.0.1:19977/p6C-c9NLr_E=/
For a more detailed help message, press "h". To detach, press "d"; to quit, press "q".
This problem occurred using the emulator first, then I switched to test it on my phone and it just cleared the log but the problem persisted, it just started all over. So, I tried to clear app data and uninstall the app from the emulator and it didn't solve a thing and this time it didn't started from scratch.
I'm a bit lost and this is starting to be a bit annoying over time to have this massive log of errors in which I don't know which one is real and which is not.
Thanks in advance for your help!
Some asked for the pubsec file
name: barty
description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
gradient_app_bar: ^0.1.3
scoped_model: ^0.3.0
flutter_secure_storage: ^3.3.1+1
flutter_map: ^0.8.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
assets:
- assets/images/image.png
- assets/images/2.0x/image.png
- assets/images/3.0x/image.png
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
fonts:
- family: Nunito
fonts:
- asset: assets/fonts/Nunito-Bold.ttf
weight: 700
- asset: assets/fonts/Nunito-BoldItalic.ttf
weight: 700
style: italic
- asset: assets/fonts/Nunito-SemiBold.ttf
weight: 600
- asset: assets/fonts/Nunito-SemiBoldItalic.ttf
weight: 600
style: italic
- asset: assets/fonts/Nunito-Regular.ttf
weight: 400
- asset: assets/fonts/Nunito-RegularItalic.ttf
weight: 400
style: italic
- asset: assets/fonts/Nunito-Light.ttf
weight: 200
- asset: assets/fonts/Nunito-Light.ttf
weight: 200
style: italic
- asset: assets/fonts/Nunito-ExtraLight.ttf
weight: 100
- asset: assets/fonts/Nunito-ExtraLightItalic.ttf
weight: 100
style: italic
And how I declare the image
Container(
width: 230,
height: 150,
child: Image.asset("assets/images/image.png"),
),