screenShot method

Future<Uint8List> screenShot()

截图

可能会抛出 PlatformException

Implementation

Future<Uint8List> screenShot() async {
  try {
    var result = await _mapChannel.invokeMethod("map#screenshot");
    if (result is List<dynamic>) {
      return Uint8List.fromList(result.map((i) => i as int).toList());
    } else if (result is Uint8List) {
      return result;
    }
    throw PlatformException(code: "不支持的类型");
  } catch (e) {
    if (e is PlatformException) {
      L.d(e.code);
      throw e;
    }
    throw Error();
  }
}