From 5280720df72a3331ca7b5f13b4418bd96d7c9045 Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Thu, 10 Jun 2021 14:08:38 +1000 Subject: [PATCH] dart migrate add_to_app/android_view/flutter_module_using_plugin (#833) --- .../flutter_module_using_plugin/lib/cell.dart | 18 ++++++++--------- .../flutter_module_using_plugin/lib/main.dart | 6 +++--- .../flutter_module_using_plugin/pubspec.lock | 20 +++++++++---------- .../flutter_module_using_plugin/pubspec.yaml | 10 +++++----- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/add_to_app/android_view/flutter_module_using_plugin/lib/cell.dart b/add_to_app/android_view/flutter_module_using_plugin/lib/cell.dart index f4ca0b3d7..98bf686e8 100644 --- a/add_to_app/android_view/flutter_module_using_plugin/lib/cell.dart +++ b/add_to_app/android_view/flutter_module_using_plugin/lib/cell.dart @@ -15,7 +15,7 @@ void main() { } class Cell extends StatefulWidget { - const Cell({Key key}) : super(key: key); + const Cell({Key? key}) : super(key: key); @override State createState() => _CellState(); @@ -26,8 +26,8 @@ class _CellState extends State with WidgetsBindingObserver { static final AccelerometerEvent defaultPosition = AccelerometerEvent(0, 0, 0); int cellNumber = 0; - Random _random; - AppLifecycleState appLifecycleState; + Random? _random; + AppLifecycleState? appLifecycleState; @override void initState() { @@ -41,13 +41,13 @@ class _CellState extends State with WidgetsBindingObserver { } }); // Keep track of what the current platform lifecycle state is. - WidgetsBinding.instance.addObserver(this); + WidgetsBinding.instance!.addObserver(this); super.initState(); } @override void dispose() { - WidgetsBinding.instance.removeObserver(this); + WidgetsBinding.instance!.removeObserver(this); super.dispose(); } @@ -62,8 +62,8 @@ class _CellState extends State with WidgetsBindingObserver { Color randomLightColor() { _random ??= Random(cellNumber); - return Color.fromARGB(255, _random.nextInt(50) + 205, - _random.nextInt(50) + 205, _random.nextInt(50) + 205); + return Color.fromARGB(255, _random!.nextInt(50) + 205, + _random!.nextInt(50) + 205, _random!.nextInt(50) + 205); } @override @@ -117,9 +117,9 @@ class _CellState extends State with WidgetsBindingObserver { // Figure out the phone's orientation relative // to gravity's direction. Ignore the z vector. transform: Matrix4.rotationX( - snapshot.data.y / gravity * pi / 2) + snapshot.data!.y / gravity * pi / 2) ..multiply(Matrix4.rotationY( - snapshot.data.x / gravity * pi / 2)), + snapshot.data!.x / gravity * pi / 2)), alignment: Alignment.center, child: const FlutterLogo(size: 72)); }, diff --git a/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart b/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart index bd39dce8a..9f05dd368 100644 --- a/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart +++ b/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart @@ -70,7 +70,7 @@ class CounterModel extends ChangeNotifier { /// It offers two routes, one suitable for displaying as a full screen and /// another designed to be part of a larger UI. class MyApp extends StatelessWidget { - const MyApp({Key key}) : super(key: key); + const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -87,7 +87,7 @@ class MyApp extends StatelessWidget { /// Wraps [Contents] in a Material [Scaffold] so it looks correct when displayed /// full-screen. class FullScreenView extends StatelessWidget { - const FullScreenView({Key key}) : super(key: key); + const FullScreenView({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -109,7 +109,7 @@ class FullScreenView extends StatelessWidget { class Contents extends StatelessWidget { final bool showExit; - const Contents({this.showExit = false, Key key}) : super(key: key); + const Contents({this.showExit = false, Key? key}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/add_to_app/android_view/flutter_module_using_plugin/pubspec.lock b/add_to_app/android_view/flutter_module_using_plugin/pubspec.lock index 259fc4996..3937e7def 100644 --- a/add_to_app/android_view/flutter_module_using_plugin/pubspec.lock +++ b/add_to_app/android_view/flutter_module_using_plugin/pubspec.lock @@ -120,21 +120,21 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" provider: dependency: "direct main" description: name: provider url: "https://pub.dartlang.org" source: hosted - version: "4.3.3" + version: "5.0.0" sensors: dependency: "direct main" description: name: sensors url: "https://pub.dartlang.org" source: hosted - version: "0.4.2+6" + version: "2.0.3" sky_engine: dependency: transitive description: flutter @@ -195,42 +195,42 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "5.7.10" + version: "6.0.6" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+4" + version: "2.0.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+9" + version: "2.0.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.9" + version: "2.0.3" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.5+3" + version: "2.0.1" url_launcher_windows: dependency: transitive description: name: url_launcher_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+3" + version: "2.0.0" vector_math: dependency: transitive description: @@ -240,4 +240,4 @@ packages: version: "2.1.0" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=1.22.0" + flutter: ">=2.0.0" diff --git a/add_to_app/android_view/flutter_module_using_plugin/pubspec.yaml b/add_to_app/android_view/flutter_module_using_plugin/pubspec.yaml index e8a1fe0fe..1ca57c552 100644 --- a/add_to_app/android_view/flutter_module_using_plugin/pubspec.yaml +++ b/add_to_app/android_view/flutter_module_using_plugin/pubspec.yaml @@ -4,19 +4,19 @@ description: An example Flutter module that uses a plugin. version: 1.0.0+1 environment: - sdk: ">=2.6.0-dev <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: sdk: flutter - provider: ^4.1.0 - url_launcher: ^5.2.5 - sensors: ^0.4.2 + provider: ^5.0.0 + url_launcher: ^6.0.6 + sensors: ^2.0.3 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^1.0.0 + flutter_lints: ^1.0.3 flutter: uses-material-design: true