liveScreenshotBytes function

Uint8List liveScreenshotBytes(
  1. Object? payload
)

The PNG in a screenshot.capture or screenshot.get payload.

Throws a LiveCommandException when there isn't one.

Implementation

Uint8List liveScreenshotBytes(Object? payload) {
  final Object? png = payload is Map ? payload['png'] : null;
  if (png is String && png.isNotEmpty) {
    try {
      return base64Decode(png);
    } on FormatException {
      // Reported below.
    }
  }
  throw LiveCommandException('The app didn\'t send a PNG.');
}