build method

Future<BitmapData?> build()

Implementation

Future<BitmapData?> build() async {
  final image = this.image;
  if (image == null) {
    throw Exception("Make sure you have called finish() before calling this function");
  }

  final byteData = await image.toByteData();
  if (byteData == null) return null;

  return BitmapData(
    colorBytes: byteData.buffer.asUint8List(),
    width: image.width,
    height: image.height,
  );
}