screenShot method

Future<void> screenShot(
  1. OnScreenShot onScreenShot
)

截图

Implementation

Future<void> screenShot(OnScreenShot onScreenShot) async {
  assert(onScreenShot != null);
  await platform(
    android: (pool) async {
      final map = await androidController.getMap();
      await map.getMapScreenShot(
        _androidMapDelegate.._onSnapshot = onScreenShot,
      );

      pool.add(map);
    },
    ios: (pool) async {
      final rect = await iosController.frame;
      await iosController.takeSnapshotInRectWithCompletionBlock(
        rect,
        (image, state) async {
          await onScreenShot(await image.data);
          pool.add(image);
        },
      );

      pool.add(rect);
    },
  );
}