Implementation
Future<void> update() async {
if (_disposed) {
return;
}
final bool hasStrings;
try {
hasStrings = await Clipboard.hasStrings();
} catch (exception, stack) {
FlutterError.reportError(
FlutterErrorDetails(
exception: exception,
stack: stack,
library: 'widget library',
context: ErrorDescription('while checking if the clipboard has strings'),
),
);
if (_disposed) {
return;
}
value = ClipboardStatus.unknown;
return;
}
final ClipboardStatus nextStatus =
hasStrings ? ClipboardStatus.pasteable : ClipboardStatus.notPasteable;
if (_disposed) {
return;
}
value = nextStatus;
}