You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the Vector Graphics library to load and draw an image.
Ensure that the image asset is properly referenced and exists.
Trigger the drawing process, leading to the error.
Expected results
If the image asset is not found or is null, the application should handle the situation gracefully, either by displaying a placeholder image or providing an error message, rather than throwing a TypeError.
Actual results
The application throws a TypeError due to a null check on a null value .
Code sample
Code sample
Unfortunately, I am unable to create a minimal reproducible sample that demonstrates the issue. The error occurs under specific circumstances that I have not been able to replicate in a simplified environment.While I am unable to create a minimal reproducible sample, I have identified the location of the error based on the logs. The error occurs in the listener.dart file at line 776 within the FlutterVectorGraphicsListener.onDrawImage method.
Screenshots or Video
Screenshots / Video demonstration
Logs
Logs
TypeErrorNull check operator used on a null valuelistener.dart in FlutterVectorGraphicsListener.onDrawImage at line: 776vector_graphics_codec.dart in VectorGraphicsCodec._readDrawImage at line: 1019vector_graphics_codec.dart in VectorGraphicsCodec.decode at line: 225listener.dart in decodeVectorGraphics.process.<fn> at line: 99zone.dart in _rootRunUnaryvector_graphics.dart in _VectorGraphicWidgetState._loadPicture.<fn> at line: 370vector_graphics.dart in _VectorGraphicWidgetState._loadAssetBytes at line: 409
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.27.4, on macOS 14.5 23F79 darwin-arm64, locale zh-Hans-CN) • Flutter version 3.27.4 on channel stable at /Users/wyqxlf/Desktop/fvm/flutter-sdk/3.27.4 • Upstream repository https://github.com/flutter/flutter.git • Framework revision d8a9f9a52e (3 months ago), 2025-01-31 16:07:18 -0500 • Engine revision 82bd5b7209 • Dart version 3.6.2 • DevTools version 2.40.3[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1) • Android SDK at /Users/wyqxlf/Library/Android/sdk • Platform android-35, build-tools 35.0.1 • ANDROID_HOME = /Users/wyqxlf/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses[✓] Xcode - develop for iOS and macOS (Xcode 16.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 16B40 • CocoaPods version 1.16.2[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome[✓] Android Studio (version 2024.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)[✓] IntelliJ IDEA Ultimate Edition (version 2024.3) • IntelliJ at /Users/wyqxlf/Applications/IntelliJ IDEA Ultimate.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart[✓] VS Code (version 1.85.1) • VS Code at /Users/wyqxlf/Desktop/Visual Studio Code.app/Contents • Flutter extension version 3.102.0
The text was updated successfully, but these errors were encountered:
@wyqlxf
This seems to be similar to #158872, so please follow-up in it for further updates.
You may share your findings in that issue for better tracking.
Closing this as a duplicate.
Steps to reproduce
Expected results
If the image asset is not found or is null, the application should handle the situation gracefully, either by displaying a placeholder image or providing an error message, rather than throwing a TypeError.
Actual results
The application throws a TypeError due to a null check on a null value .
Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
Logs
Logs
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: