Repository: flutter
Issue: Clipboard.setData throws exception when used with delay function (web)
Labels: framework,d: api docs,platform-web,f: focus,has reproducible steps,P2,found in release: 3.0,found in release: 3.1,team-web,triaged-web

When the Clipboard is accessed on web with a safari based browser engine, it only works in functions which are not async or within some future-then construct.

## Steps to Reproduce

I attached an example. Please do the following:

1. startup some web server locally, e.g. `flutter run -d web-server --web-hostname 0.0.0.0 --web-port 8089`
2. browse to the website with a safari based browser (e.g. safari on macOS, or an iOS device)
3. click the buttons in my example
4. Check the clipboard conent, only the "normal" button works as expected

**Expected results:** Clipboard is written

**Actual results:** Platform exception is thrown

<details>
<summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              TextButton(
                onPressed: () {
                  Clipboard.setData(const ClipboardData(text: "normal"));
                },
                child: const Text('normal'),
              ),
              TextButton(
                onPressed: () {
                  Future.delayed(const Duration(seconds: 1)).then((value) {
                    Clipboard.setData(const ClipboardData(text: "then"));
                  });
                },
                child: const Text('then'),
              ),
              TextButton(
                onPressed: () async {
                  await Future.delayed(const Duration(seconds: 1));
                  Clipboard.setData(const ClipboardData(text: "async"));
                },
                child: const Text('async'),
              )
            ],
          ),
        ),
      ),
    );
  }
}

```
</details>

<details>
<summary>Logs</summary>


```
[√] Flutter (Channel stable, 3.0.2, on Microsoft Windows [Version 10.0.19044.1706], locale de-DE)
    • Flutter version 3.0.2 at E:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (7 days ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\mtrie\AppData\Local\Android\sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: E:\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.10.0)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
    • Visual Studio Build Tools 2019 version 16.10.31321.278
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 4.1)
    • Android Studio at E:\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.69.0-insider)
    • VS Code at C:\Users\mtrie\AppData\Local\Programs\Microsoft VS Code Insiders
    • Flutter extension version 3.42.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19044.1706]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 102.0.5005.115
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 102.0.1245.33

[√] HTTP Host Availability
    • All required HTTP hosts are available
```