Flutter – Clipboard

This week also let’s learn flutter new things. I will show you how to copy and paste a text with flutter. Let’s start coding.

First thing we need to do is add this clipboard package in pubspec.yaml file.

flutter pub add clipboard

Copy to clipboard

FlutterClipboard.copy(field.text).then(( value ) => print('copied'));

Paste from clipboard

FlutterClipboard.paste().then((value) {
    // Do what ever you want with the value.
    setState(() {
      field.text = value;
      pasteValue = value;
    });
  });

For text editing field :

TextEditingController field = TextEditingController();
TextFormField(
                controller: field,
                decoration: const InputDecoration(
                    hintText: 'Enter text'
                ),
              ),

Hope you enjoyed this article!

By ami



アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム