copyImageToClipboard method

  1. @override
Future<void> copyImageToClipboard(
  1. Uint8List imageBytes
)
override

Copies an image to the system clipboard to be pasted on other apps.

Implementation

@override
Future<void> copyImageToClipboard(Uint8List imageBytes) async {
  try {
    await _hostApi.copyImageToClipboard(imageBytes);
  } on PlatformException catch (e) {
    if (kDebugMode && e.code == 'ANDROID_MANIFEST_NOT_CONFIGURED') {
      debugPrint(
        'It looks like your AndroidManifest.xml is not configured properly '
        'to support copying images to the clipboard on Android.\n'
        "If you're interested in this feature, refer to https://github.com/FlutterQuill/quill-native-bridge/tree/main/quill_native_bridge#-platform-configuration\n"
        'This message will only shown in debug mode.\n'
        'Platform details: ${e.toString()}',
      );
      throw AssertionError(
        'Optional AndroidManifest configuration is missing. '
        'Copying images to the clipboard on Android require modifying `AndroidManifest.xml`. '
        'A message was shown above this error for more details. This'
        'error will only arise in debug mode.',
      );
    }
    rethrow;
  }
}