dart migrate add_to_app/multiple_flutters/multiple_flutters_module (#836)

pull/841/head
Brett Morgan 3 years ago committed by GitHub
parent 4633bb0406
commit e931456f20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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}');

@ -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:

Loading…
Cancel
Save