Migrate flavors to null safety (#80558)
This commit is contained in:
committed by
GitHub
parent
ecbea9a9d5
commit
0c1652f448
@@ -12,19 +12,19 @@ void main() {
|
||||
}
|
||||
|
||||
class Flavor extends StatefulWidget {
|
||||
const Flavor({Key key}) : super(key: key);
|
||||
const Flavor({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_FlavorState createState() => _FlavorState();
|
||||
}
|
||||
|
||||
class _FlavorState extends State<Flavor> {
|
||||
String _flavor;
|
||||
String? _flavor;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
const MethodChannel('flavor').invokeMethod<String>('getFlavor').then((String flavor) {
|
||||
const MethodChannel('flavor').invokeMethod<String>('getFlavor').then((String? flavor) {
|
||||
setState(() {
|
||||
_flavor = flavor;
|
||||
});
|
||||
@@ -37,7 +37,7 @@ class _FlavorState extends State<Flavor> {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: _flavor == null
|
||||
? const Text('Awaiting flavor...')
|
||||
: Text(_flavor, key: const ValueKey<String>('flavor')),
|
||||
: Text(_flavor!, key: const ValueKey<String>('flavor')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ name: flavors
|
||||
description: Integration test for build flavors.
|
||||
|
||||
environment:
|
||||
sdk: ">=2.0.0-dev.68.0 <3.0.0"
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
|
||||
void main() {
|
||||
group('flavors suite', () {
|
||||
FlutterDriver driver;
|
||||
late FlutterDriver driver;
|
||||
|
||||
setUpAll(() async {
|
||||
driver = await FlutterDriver.connect();
|
||||
@@ -20,7 +20,7 @@ void main() {
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
driver?.close();
|
||||
driver.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user