flutter_svg icon indicating copy to clipboard operation
flutter_svg copied to clipboard

Bad state: A Dart object attempted to access a native peer, but the native peer has been collected (nullptr). This is usually the result of calling methods on a native-backed object when the native resources have already been disposed.

Open bojianyin opened this issue 1 year ago • 0 comments

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Bad state: A Dart object attempted to access a native peer, but the native peer has been collected (nullptr). This is usually the result of calling methods on a native-backed object when the native resources have already been disposed. E/flutter ( 7816): #0 StateError._throwNew (dart:core-patch/errors_patch.dart:135:5) E/flutter ( 7816): #1 _NativeCanvas._drawImage (dart:ui/painting.dart) E/flutter ( 7816): #2 _NativeCanvas.drawImage (dart:ui/painting.dart:6014:27) E/flutter ( 7816): #3 SliderPainter._drawThumbNodes (package:lib_kit/widgets/slider/slider_painter.dart:73:12) E/flutter ( 7816):

    SvgAssetLoader loader = SvgAssetLoader('images/svg/public_selected_square.svg',packageName: 'lib_resource');
    final PictureInfo pictureInfo = await vg.loadPicture(loader, null);
    // final PictureInfo pictureInfo = await vg.loadPicture(SvgStringLoader(rawSvg), null);
    ui.Image image = await pictureInfo.picture.toImage(20, 20);

    canvas.drawImage(image,Offset(0, 0),nodePaint);```

bojianyin avatar May 14 '24 07:05 bojianyin