# At least one clipboard data variant must be provided

> In preparation for supporting multiple clipboard data variants, at least one clipboard data variant must be provided.




:::important
These breaking change docs are accurate, as of the release
under which they are published. Over time, the
workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up
to date as of each release.

The [breaking change index file](/release/breaking-changes)
lists the docs created for each release.
:::


## Summary

The [`ClipboardData constructor`][]'s `text` argument is no longer nullable.
Code that provides `null` to the `text` argument must be migrated to provide
an empty string `''`.

## Context

In preparation for supporting multiple clipboard data variants, the
`ClipboardData` constructor now requires that at least one data variant is
provided.

Previously, platforms were inconsistent in how they handled `null`.
The behavior is now consistent across platforms. If you are interested
in the low-level details, see [PR 122446][].

## Description of change

The [`ClipboardData constructor`][]'s `text` argument is no longer nullable.

## Migration guide

To reset the text clipboard, use an empty string `''` instead of `null`.

Code before migration:

```dart
void resetClipboard() {
  Clipboard.setData(ClipboardData(text: null));
}
```

Code after migration:

```dart
void resetClipboard() {
  Clipboard.setData(ClipboardData(text: ''));
}
```

## Timeline

Landed in version: 3.10.0-9.0.pre<br>
In stable release: 3.10.0

## References

API documentation:

* [`Clipboard.setData`][]
* [`ClipboardData constructor`][]

Relevant PRs:

* [Assert at least one clipboard data variant is provided][]

[`ClipboardData constructor`]: https://api.flutter.dev/flutter/services/ClipboardData/ClipboardData.html
[`Clipboard.setData`]: https://api.flutter.dev/flutter/services/Clipboard/setData.html
[PR 122446]: https://github.com/flutter/flutter/pull/122446
[Assert at least one clipboard data variant is provided]: https://github.com/flutter/flutter/pull/122446

