plugin template min flutter sdk version to 1.20 (#62605)

This commit is contained in:
Chris Yang
2020-08-04 12:31:05 -07:00
committed by GitHub
parent e8ad863a08
commit 2459f5c513
2 changed files with 17 additions and 1 deletions

View File

@@ -6,7 +6,7 @@ homepage:
environment:
sdk: ">=2.7.0 <3.0.0"
flutter: ">=1.17.0 <2.0.0"
flutter: ">=1.20.0 <2.0.0"
dependencies:
flutter:

View File

@@ -23,6 +23,7 @@ import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/version.dart';
import 'package:mockito/mockito.dart';
import 'package:process/process.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:pubspec_parse/pubspec_parse.dart';
import '../../src/common.dart';
@@ -1966,6 +1967,21 @@ void main() {
Logger: () => logger,
});
testUsingContext('newly created plugin has min flutter sdk version as 1.20.0', () async {
Cache.flutterRoot = '../..';
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
final String rawPubspec = await projectDir.childFile('pubspec.yaml').readAsString();
final Pubspec pubspec = Pubspec.parse(rawPubspec);
final Map<String, VersionConstraint> env = pubspec.environment;
expect(env['flutter'].allows(Version(1, 20, 0)), true);
expect(env['flutter'].allows(Version(1, 19, 0)), false);
});
}
Future<void> _createProject(