In principle this is backwards compatible; I just merged all the classes into one and deprecated everything that became redundant as a result.
This commit is contained in:
@@ -135,7 +135,7 @@ import '$generatedImport';
|
||||
import '$mainImport' as entrypoint;
|
||||
|
||||
Future<void> main() async {
|
||||
registerPlugins(webPluginRegistry);
|
||||
registerPlugins(webPluginRegistrar);
|
||||
await ui.webOnlyInitializePlatform();
|
||||
entrypoint.main();
|
||||
}
|
||||
|
||||
@@ -686,7 +686,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
|
||||
'typedef _NullaryFunction = dynamic Function();',
|
||||
'Future<void> main() async {',
|
||||
if (hasWebPlugins)
|
||||
' registerPlugins(webPluginRegistry);',
|
||||
' registerPlugins(webPluginRegistrar);',
|
||||
' await ui.webOnlyInitializePlatform();',
|
||||
' if (entrypoint.main is _UnaryFunction) {',
|
||||
' return (entrypoint.main as _UnaryFunction)(<String>[]);',
|
||||
|
||||
@@ -779,9 +779,6 @@ const String _dartPluginRegistryTemplate = '''
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// ignore: unused_import
|
||||
import 'dart:ui';
|
||||
|
||||
{{#plugins}}
|
||||
import 'package:{{name}}/{{file}}';
|
||||
{{/plugins}}
|
||||
@@ -789,11 +786,11 @@ import 'package:{{name}}/{{file}}';
|
||||
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
|
||||
|
||||
// ignore: public_member_api_docs
|
||||
void registerPlugins(PluginRegistry registry) {
|
||||
void registerPlugins(Registrar registrar) {
|
||||
{{#plugins}}
|
||||
{{class}}.registerWith(registry.registrarFor({{class}}));
|
||||
{{class}}.registerWith(registrar);
|
||||
{{/plugins}}
|
||||
registry.registerMessageHandler();
|
||||
registrar.registerMessageHandler();
|
||||
}
|
||||
''';
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class {{pluginDartClass}}Web {
|
||||
final MethodChannel channel = MethodChannel(
|
||||
'{{projectName}}',
|
||||
const StandardMethodCodec(),
|
||||
registrar.messenger,
|
||||
registrar,
|
||||
);
|
||||
|
||||
final pluginInstance = {{pluginDartClass}}Web();
|
||||
|
||||
@@ -83,7 +83,7 @@ void main() {
|
||||
|
||||
// Plugins
|
||||
expect(generated, contains("import 'package:foo/generated_plugin_registrant.dart';"));
|
||||
expect(generated, contains('registerPlugins(webPluginRegistry);'));
|
||||
expect(generated, contains('registerPlugins(webPluginRegistrar);'));
|
||||
|
||||
// Main
|
||||
expect(generated, contains('entrypoint.main();'));
|
||||
@@ -185,7 +185,7 @@ void main() {
|
||||
|
||||
// Plugins
|
||||
expect(generated, contains("import 'package:foo/generated_plugin_registrant.dart';"));
|
||||
expect(generated, contains('registerPlugins(webPluginRegistry);'));
|
||||
expect(generated, contains('registerPlugins(webPluginRegistrar);'));
|
||||
|
||||
// Main
|
||||
expect(generated, contains('entrypoint.main();'));
|
||||
@@ -208,7 +208,7 @@ void main() {
|
||||
|
||||
// Plugins
|
||||
expect(generated, isNot(contains("import 'package:foo/generated_plugin_registrant.dart';")));
|
||||
expect(generated, isNot(contains('registerPlugins(webPluginRegistry);')));
|
||||
expect(generated, isNot(contains('registerPlugins(webPluginRegistrar);')));
|
||||
// Main
|
||||
expect(generated, contains('entrypoint.main();'));
|
||||
}));
|
||||
@@ -253,7 +253,7 @@ void main() {
|
||||
|
||||
// Plugins
|
||||
expect(generated, isNot(contains("import 'package:foo/generated_plugin_registrant.dart';")));
|
||||
expect(generated, isNot(contains('registerPlugins(webPluginRegistry);')));
|
||||
expect(generated, isNot(contains('registerPlugins(webPluginRegistrar);')));
|
||||
|
||||
// Main
|
||||
expect(generated, contains('entrypoint.main();'));
|
||||
|
||||
Reference in New Issue
Block a user