Skip to content

Commit

Permalink
Automatically migrate ClipboardData.text to non-null (#129567)
Browse files Browse the repository at this point in the history
#122446 was a breaking change in Flutter 3.10 that made the `ClipboardData` constructor's `text` argument a required non-nullable argument. This leverages `dart fix`'s new automatic migration to, well, automatically migrate affected users.

Manual migration docs: https://docs.flutter.dev/release/breaking-changes/clipboard-data-required

Follow-up to #122446
Part of #121976
  • Loading branch information
loic-sharma committed Jun 27, 2023
1 parent ca6f23e commit 5a5b58a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/flutter/lib/fix_data/fix_services.yaml
Expand Up @@ -18,6 +18,20 @@
# * Fixes in this file are from the Services library. *
version: 1
transforms:
# Changes made in https://github.com/flutter/flutter/pull/122446
- title: "Migrate to empty 'text' string"
date: 2023-06-26
element:
uris: [ 'services.dart' ]
constructor: ''
inClass: 'ClipboardData'
changes:
- kind: 'changeParameterType'
name: 'text'
nullability: 'non_null'
argumentValue:
expression: "''"

# Changes made in https://github.com/flutter/flutter/pull/60320
- title: "Migrate to 'viewId'"
date: 2020-07-05
Expand Down
4 changes: 4 additions & 0 deletions packages/flutter/test_fixes/services/services.dart
Expand Up @@ -5,6 +5,10 @@
import 'package:flutter/services.dart';

void main() {
// Changes made in https://github.com/flutter/flutter/pull/122446
final clipboardData1 = ClipboardData();
final clipboardData2 = ClipboardData(text: null);

// Changes made in https://github.com/flutter/flutter/pull/60320
final SurfaceAndroidViewController surfaceController = SurfaceAndroidViewController(
viewId: 10,
Expand Down
4 changes: 4 additions & 0 deletions packages/flutter/test_fixes/services/services.dart.expect
Expand Up @@ -5,6 +5,10 @@
import 'package:flutter/services.dart';

void main() {
// Changes made in https://github.com/flutter/flutter/pull/122446
final clipboardData1 = ClipboardData(text: '');
final clipboardData2 = ClipboardData(text: '');

// Changes made in https://github.com/flutter/flutter/pull/60320
final SurfaceAndroidViewController surfaceController = SurfaceAndroidViewController(
viewId: 10,
Expand Down

0 comments on commit 5a5b58a

Please sign in to comment.