1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 22:09:06 +00:00

dart migrate add_to_app/multiple_flutters/multiple_flutters_module (#836)

This commit is contained in:
Brett Morgan
2021-06-10 14:02:44 +10:00
committed by GitHub
parent 4633bb0406
commit e931456f20
2 changed files with 6 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ void topMain() => runApp(const MyApp(color: Colors.green));
void bottomMain() => runApp(const MyApp(color: Colors.purple)); void bottomMain() => runApp(const MyApp(color: Colors.purple));
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key key, @required this.color}) : super(key: key); const MyApp({Key? key, required this.color}) : super(key: key);
final MaterialColor color; final MaterialColor color;
@@ -31,7 +31,7 @@ class MyApp extends StatelessWidget {
} }
class MyHomePage extends StatefulWidget { class MyHomePage extends StatefulWidget {
const MyHomePage({Key key, this.title}) : super(key: key); const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title; final String title;
@override @override
@@ -39,8 +39,8 @@ class MyHomePage extends StatefulWidget {
} }
class _MyHomePageState extends State<MyHomePage> { class _MyHomePageState extends State<MyHomePage> {
int _counter = 0; int? _counter = 0;
MethodChannel _channel; late MethodChannel _channel;
@override @override
void initState() { void initState() {
@@ -50,7 +50,7 @@ class _MyHomePageState extends State<MyHomePage> {
if (call.method == "setCount") { if (call.method == "setCount") {
// A notification that the host platform's data model has been updated. // A notification that the host platform's data model has been updated.
setState(() { setState(() {
_counter = call.arguments as int; _counter = call.arguments as int?;
}); });
} else { } else {
throw Exception('not implemented ${call.method}'); throw Exception('not implemented ${call.method}');

View File

@@ -4,7 +4,7 @@ description: A module that is embedded in the multiple_flutters_ios and multiple
version: 1.0.0+1 version: 1.0.0+1
environment: environment:
sdk: ">=2.8.1 <3.0.0" sdk: '>=2.12.0 <3.0.0'
dependencies: dependencies:
flutter: flutter: