toImage method
Creates an image from this picture.
The returned image will be width
pixels wide and height
pixels high.
The picture is rasterized within the 0 (left), 0 (top), width
(right),
height
(bottom) bounds. Content outside these bounds is clipped.
Although the image is returned synchronously, the picture is actually rasterized the first time the image is drawn and then cached.
Implementation
Future<Image> toImage(int width, int height) {
if (width <= 0 || height <= 0)
throw Exception('Invalid image dimensions.');
return _futurize(
(_Callback<Image> callback) => _toImage(width, height, callback)
);
}