RenderRepaintBoundary boundary = globalKey.currentContext.findRenderObject()
as RenderRepaintBoundary;
var image = await boundary.toImage(pixelRatio: pixelRatio);boundary.toImage(pixelRatio: pixelRatio); ##抛出错误
[ERROR:flutter/shell/common/shell.cc(242)] Dart Unhandled Exception: NoSuchMethodError: The getter '_handles' was called on null.
Receiver: null
Tried calling: _handles, stack trace: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
: #1 new Image._ (dart:ui/painting.dart:1601:12)
: #2 Scene.toImage.<anonymous closure>.<anonymous closure> (dart:ui/compositing.dart:35:24)两周前它运行得很好,但现在它正在抛出这个错误。我怎么才能修好它?
发布于 2021-07-13 10:40:40
所以基本上问题是在boundary.toImage(pixelRatio: pixelRatio);中
将其更改为boundary.toImage();
一切都会好的
https://stackoverflow.com/questions/68346734
复制相似问题