Fix plugin template app's tests#39080
Conversation
|
|
||
| Future<void> addPlugin(String plugin) async { | ||
| Future<void> addPlugin(String plugin, {String pluginPath}) async { | ||
| final File pubspec = File(path.join(rootPath, 'pubspec.yaml')); |
There was a problem hiding this comment.
Does addPlugin have to be a method on the _FlutterPlugin class? It looks to me the two classes _FlutterProject and _FlutterPlugin are quite similar except the binary/project name? Wondering whether you'll have to define two classes.
There was a problem hiding this comment.
_FlutterPlugin extends _FlutterProject.
I've moved addPlugin from _FlutterApp into _FlutterProject and test from _FlutterPlugin into _FlutterProject since they make sense for both plugins and apps.
I haven't written any test that have plugins depending on plugins, but I added a line that ensures that the template app's unit tests pass.
| } | ||
|
|
||
| class _FlutterPlugin extends _FlutterProject { | ||
| _FlutterPlugin(Directory parent, String name) : super(parent, name); |
There was a problem hiding this comment.
Is it possible to have everything in the _FlutterProject class?
It appears you can define a create method with template, project_name/binary_name arguments, and simply create:
- plugin by calling
create('plugin', 'plugintest', ...); - app by calling
create('app', 'plugintestapp').
There was a problem hiding this comment.
I could go either way on this. Since it's not a public API and is confined to this file it's easy to change later. I've consolidated everything into one class since you seem to prefer that.
Description
Plugin template app needs to be updated with this breaking change:
https://groups.google.com/forum/#!msg/flutter-announce/sHAL2fBtJ1Y/mGjrKH3dEwAJ
Related Issues
Fixes #39077
Tests
I included the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?