pasteboard 0.4.0 copy "pasteboard: ^0.4.0" to clipboard
pasteboard: ^0.4.0 copied to clipboard

A flutter plugin which could read image,files from clipboard and write files to clipboard.

pasteboard #

Pub

A Flutter plugin that allows reading images and files from the clipboard and writing files to the clipboard.

Platform Supported Requires Setup
Windows No
Linux No
macOS No
iOS No
Web No
Android Yes

Getting Started #

  1. Add package:pasteboard to pubspec.yaml:

    dependencies:
      pasteboard: ^latest
    
  2. example

    import 'package:pasteboard/pasteboard.dart';
    
    Future<void> readAndWriteFiles() async {
      final paths = ['your_file_path'];
      await Pasteboard.writeFiles(paths);
    
      final files = await Pasteboard.files();
      print(files);
    }
    
    Future<void> readImages() async {
      final imageBytes = await Pasteboard.image;
      print(imageBytes?.length);
    }
    

Android Setup #

To use this package on Android without errors, follow these steps:

  1. Add the following <provider> entry inside the <application> tag in your AndroidManifest.xml (android/app/src/main/AndroidManifest.xml):
<provider
    android:name="androidx.core.content.FileProvider"
    android:authorities="${applicationId}.provider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/provider_paths" />
</provider>
  1. Create the file provider_paths.xml at android/app/src/main/res/xml/provider_paths.xml with the following content:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path
        name="external_files"
        path="." />
</paths>

Common Issues #

If these steps are not followed, you may encounter the following runtime error:

Couldn't find meta-data for provider with authority

Make sure the <provider> entry is correctly added to the AndroidManifest.xml and that the provider_paths.xml file exists in the correct location.

License #

See the LICENSE file for the full license.

98
likes
150
points
22.5k
downloads

Publisher

verified publishermixin.dev

Weekly Downloads

A flutter plugin which could read image,files from clipboard and write files to clipboard.

Repository (GitHub)

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_web_plugins, path, uuid, web

More

Packages that depend on pasteboard