[flutter_tools] No more implicit --no-sound-null-safety (#118491)
* remove implicit no-sound-null-safety * add test * bump sdk constraint in test file
This commit is contained in:
committed by
GitHub
parent
8a58ec5c32
commit
374f09e1a6
@@ -554,6 +554,27 @@ void main() {
|
||||
ProcessManager: () => processManager,
|
||||
});
|
||||
|
||||
testUsingContext('tool exits on non-sound-null-safe code when explicit flag not passed', () async {
|
||||
final DummyFlutterCommand flutterCommand = DummyFlutterCommand(packagesPath: 'foo');
|
||||
flutterCommand.argParser
|
||||
..addFlag(FlutterOptions.kNullSafety, defaultsTo: true)
|
||||
..addOption('target');
|
||||
final File targetFile = fileSystem.file('targetFile.dart')
|
||||
..writeAsStringSync('// @dart = 2.11');
|
||||
expect(
|
||||
() async => flutterCommand.getBuildInfo(
|
||||
forcedBuildMode: BuildMode.debug,
|
||||
forcedTargetFile: targetFile,
|
||||
),
|
||||
throwsToolExit(
|
||||
message: 'This application does not support sound null-safety (its language version is 2.11)',
|
||||
),
|
||||
);
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
});
|
||||
|
||||
testUsingContext('use packagesPath to generate BuildInfo', () async {
|
||||
final DummyFlutterCommand flutterCommand = DummyFlutterCommand(packagesPath: 'foo');
|
||||
final BuildInfo buildInfo = await flutterCommand.getBuildInfo(forcedBuildMode: BuildMode.debug);
|
||||
|
||||
@@ -65,7 +65,7 @@ class WebSteppingProject extends Project {
|
||||
final String pubspec = '''
|
||||
name: test
|
||||
environment:
|
||||
sdk: '>=2.10.0 <4.0.0'
|
||||
sdk: '>=2.12.0 <4.0.0'
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
Reference in New Issue
Block a user