Migrate flavors to null safety (#80558)

This commit is contained in:
Abhishek Ghaskata
2021-04-20 08:44:03 +05:30
committed by GitHub
parent ecbea9a9d5
commit 0c1652f448
3 changed files with 7 additions and 7 deletions

View File

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

View File

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

View File

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