mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
dart migrate add_to_app/multiple_flutters/multiple_flutters_module (#836)
This commit is contained in:
@@ -14,7 +14,7 @@ void topMain() => runApp(const MyApp(color: Colors.green));
|
||||
void bottomMain() => runApp(const MyApp(color: Colors.purple));
|
||||
|
||||
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;
|
||||
|
||||
@@ -31,7 +31,7 @@ class MyApp extends StatelessWidget {
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@override
|
||||
@@ -39,8 +39,8 @@ class MyHomePage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
int _counter = 0;
|
||||
MethodChannel _channel;
|
||||
int? _counter = 0;
|
||||
late MethodChannel _channel;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -50,7 +50,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
if (call.method == "setCount") {
|
||||
// A notification that the host platform's data model has been updated.
|
||||
setState(() {
|
||||
_counter = call.arguments as int;
|
||||
_counter = call.arguments as int?;
|
||||
});
|
||||
} else {
|
||||
throw Exception('not implemented ${call.method}');
|
||||
|
||||
Reference in New Issue
Block a user