Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[vector_graphics]TypeError: Null Check Operator Used on a Null Value in Vector Graphics Library #168364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wyqlxf opened this issue May 6, 2025 · 2 comments
Labels
r: duplicate Issue is closed as a duplicate of an existing issue

Comments

@wyqlxf
Copy link
Contributor

wyqlxf commented May 6, 2025

Steps to reproduce

  1. Use the Vector Graphics library to load and draw an image.
  2. Ensure that the image asset is properly referenced and exists.
  3. 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

Image

Image

Logs

Logs
TypeError
Null check operator used on a null value

listener.dart in FlutterVectorGraphicsListener.onDrawImage at line: 776
vector_graphics_codec.dart in VectorGraphicsCodec._readDrawImage at line: 1019
vector_graphics_codec.dart in VectorGraphicsCodec.decode at line: 225
listener.dart in decodeVectorGraphics.process.<fn> at line: 99
zone.dart in _rootRunUnary

vector_graphics.dart in _VectorGraphicWidgetState._loadPicture.<fn> at line: 370
vector_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
@darshankawar darshankawar added the in triage Presently being triaged by the triage team label May 6, 2025
@darshankawar
Copy link
Member

@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.

@darshankawar darshankawar added r: duplicate Issue is closed as a duplicate of an existing issue and removed in triage Presently being triaged by the triage team labels May 6, 2025
@wyqlxf
Copy link
Contributor Author

wyqlxf commented May 7, 2025

@darshankawar ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r: duplicate Issue is closed as a duplicate of an existing issue
Projects
None yet
Development

No branches or pull requests

2 participants