@@ -48,12 +48,8 @@ class CreateCommand extends CreateBase {
|
||||
flutterProjectTypeToString(FlutterProjectType.package): 'Generate a shareable Flutter project containing modular '
|
||||
'Dart code.',
|
||||
flutterProjectTypeToString(FlutterProjectType.plugin): 'Generate a shareable Flutter project containing an API '
|
||||
'in Dart code with a platform-specific implementation through method channels for Android, iOS, '
|
||||
'Linux, macOS, Windows, web, or any combination of these.',
|
||||
flutterProjectTypeToString(FlutterProjectType.ffiPlugin):
|
||||
'Generate a shareable Flutter project containing an API '
|
||||
'in Dart code with a platform-specific implementation through dart:ffi for Android, iOS, '
|
||||
'Linux, macOS, Windows, or any combination of these.',
|
||||
'in Dart code with a platform-specific implementation for Android, for iOS code, or '
|
||||
'for both.',
|
||||
flutterProjectTypeToString(FlutterProjectType.module): 'Generate a project to add a Flutter module to an '
|
||||
'existing Android or iOS application.',
|
||||
},
|
||||
@@ -163,17 +159,18 @@ class CreateCommand extends CreateBase {
|
||||
final bool metadataExists = projectDir.absolute.childFile('.metadata').existsSync();
|
||||
if (argResults['template'] != null) {
|
||||
template = stringToProjectType(stringArg('template'));
|
||||
}
|
||||
// If the project directory exists and isn't empty, then try to determine the template
|
||||
// type from the project directory.
|
||||
if (projectDir.existsSync() && projectDir.listSync().isNotEmpty) {
|
||||
detectedProjectType = determineTemplateType();
|
||||
if (detectedProjectType == null && metadataExists) {
|
||||
// We can only be definitive that this is the wrong type if the .metadata file
|
||||
// exists and contains a type that we don't understand, or doesn't contain a type.
|
||||
throwToolExit('Sorry, unable to detect the type of project to recreate. '
|
||||
'Try creating a fresh project and migrating your existing code to '
|
||||
'the new project manually.');
|
||||
} else {
|
||||
// If the project directory exists and isn't empty, then try to determine the template
|
||||
// type from the project directory.
|
||||
if (projectDir.existsSync() && projectDir.listSync().isNotEmpty) {
|
||||
detectedProjectType = determineTemplateType();
|
||||
if (detectedProjectType == null && metadataExists) {
|
||||
// We can only be definitive that this is the wrong type if the .metadata file
|
||||
// exists and contains a type that we don't understand, or doesn't contain a type.
|
||||
throwToolExit('Sorry, unable to detect the type of project to recreate. '
|
||||
'Try creating a fresh project and migrating your existing code to '
|
||||
'the new project manually.');
|
||||
}
|
||||
}
|
||||
}
|
||||
template ??= detectedProjectType ?? FlutterProjectType.app;
|
||||
@@ -209,8 +206,7 @@ class CreateCommand extends CreateBase {
|
||||
|
||||
final FlutterProjectType template = _getProjectType(projectDir);
|
||||
final bool generateModule = template == FlutterProjectType.module;
|
||||
final bool generateMethodChannelsPlugin = template == FlutterProjectType.plugin;
|
||||
final bool generateFfiPlugin = template == FlutterProjectType.ffiPlugin;
|
||||
final bool generatePlugin = template == FlutterProjectType.plugin;
|
||||
final bool generatePackage = template == FlutterProjectType.package;
|
||||
|
||||
final List<String> platforms = stringsArg('platforms');
|
||||
@@ -224,23 +220,6 @@ class CreateCommand extends CreateBase {
|
||||
} else if (platforms == null || platforms.isEmpty) {
|
||||
throwToolExit('Must specify at least one platform using --platforms',
|
||||
exitCode: 2);
|
||||
} else if (generateFfiPlugin && argResults.wasParsed('platforms') && platforms.contains('web')) {
|
||||
throwToolExit(
|
||||
'The web platform is not supported in plugin_ffi template.',
|
||||
exitCode: 2,
|
||||
);
|
||||
} else if (generateFfiPlugin && argResults.wasParsed('ios-language')) {
|
||||
throwToolExit(
|
||||
'The "ios-language" option is not supported with the plugin_ffi '
|
||||
'template: the language will always be C or C++.',
|
||||
exitCode: 2,
|
||||
);
|
||||
} else if (generateFfiPlugin && argResults.wasParsed('android-language')) {
|
||||
throwToolExit(
|
||||
'The "android-language" option is not supported with the plugin_ffi '
|
||||
'template: the language will always be C or C++.',
|
||||
exitCode: 2,
|
||||
);
|
||||
}
|
||||
|
||||
final String organization = await getOrganization();
|
||||
@@ -278,8 +257,7 @@ class CreateCommand extends CreateBase {
|
||||
titleCaseProjectName: titleCaseProjectName,
|
||||
projectDescription: stringArg('description'),
|
||||
flutterRoot: flutterRoot,
|
||||
withPlatformChannelPluginHook: generateMethodChannelsPlugin,
|
||||
withFfiPluginHook: generateFfiPlugin,
|
||||
withPluginHook: generatePlugin,
|
||||
androidLanguage: stringArg('android-language'),
|
||||
iosLanguage: stringArg('ios-language'),
|
||||
iosDevelopmentTeam: developmentTeam,
|
||||
@@ -348,15 +326,7 @@ class CreateCommand extends CreateBase {
|
||||
);
|
||||
break;
|
||||
case FlutterProjectType.plugin:
|
||||
generatedFileCount += await _generateMethodChannelPlugin(
|
||||
relativeDir,
|
||||
templateContext,
|
||||
overwrite: overwrite,
|
||||
printStatusWhenWriting: !creatingNewProject,
|
||||
);
|
||||
break;
|
||||
case FlutterProjectType.ffiPlugin:
|
||||
generatedFileCount += await _generateFfiPlugin(
|
||||
generatedFileCount += await _generatePlugin(
|
||||
relativeDir,
|
||||
templateContext,
|
||||
overwrite: overwrite,
|
||||
@@ -384,7 +354,7 @@ class CreateCommand extends CreateBase {
|
||||
'main.dart',
|
||||
));
|
||||
globals.printStatus('Your module code is in $relativeMainPath.');
|
||||
} else if (generateMethodChannelsPlugin) {
|
||||
} else if (generatePlugin) {
|
||||
final String relativePluginPath = globals.fs.path.normalize(globals.fs.path.relative(projectDirPath));
|
||||
final List<String> requestedPlatforms = _getUserRequestedPlatforms();
|
||||
final String platformsString = requestedPlatforms.join(', ');
|
||||
@@ -490,7 +460,7 @@ Your $application code is in $relativeAppMain.
|
||||
return generatedCount;
|
||||
}
|
||||
|
||||
Future<int> _generateMethodChannelPlugin(
|
||||
Future<int> _generatePlugin(
|
||||
Directory directory,
|
||||
Map<String, dynamic> templateContext, {
|
||||
bool overwrite = false,
|
||||
@@ -517,8 +487,8 @@ Your $application code is in $relativeAppMain.
|
||||
? stringArg('description')
|
||||
: 'A new flutter plugin project.';
|
||||
templateContext['description'] = description;
|
||||
generatedCount += await renderMerged(
|
||||
<String>['plugin', 'plugin_shared'],
|
||||
generatedCount += await renderTemplate(
|
||||
'plugin',
|
||||
directory,
|
||||
templateContext,
|
||||
overwrite: overwrite,
|
||||
@@ -565,82 +535,6 @@ Your $application code is in $relativeAppMain.
|
||||
return generatedCount;
|
||||
}
|
||||
|
||||
Future<int> _generateFfiPlugin(
|
||||
Directory directory,
|
||||
Map<String, dynamic> templateContext, {
|
||||
bool overwrite = false,
|
||||
bool printStatusWhenWriting = true,
|
||||
}) async {
|
||||
// Plugins only add a platform if it was requested explicitly by the user.
|
||||
if (!argResults.wasParsed('platforms')) {
|
||||
for (final String platform in kAllCreatePlatforms) {
|
||||
templateContext[platform] = false;
|
||||
}
|
||||
}
|
||||
final List<String> platformsToAdd =
|
||||
_getSupportedPlatformsFromTemplateContext(templateContext);
|
||||
|
||||
final List<String> existingPlatforms =
|
||||
_getSupportedPlatformsInPlugin(directory);
|
||||
for (final String existingPlatform in existingPlatforms) {
|
||||
// re-generate files for existing platforms
|
||||
templateContext[existingPlatform] = true;
|
||||
}
|
||||
|
||||
final bool willAddPlatforms = platformsToAdd.isNotEmpty;
|
||||
templateContext['no_platforms'] = !willAddPlatforms;
|
||||
int generatedCount = 0;
|
||||
final String description = argResults.wasParsed('description')
|
||||
? stringArg('description')
|
||||
: 'A new Flutter FFI plugin project.';
|
||||
templateContext['description'] = description;
|
||||
generatedCount += await renderMerged(
|
||||
<String>['plugin_ffi', 'plugin_shared'],
|
||||
directory,
|
||||
templateContext,
|
||||
overwrite: overwrite,
|
||||
printStatusWhenWriting: printStatusWhenWriting,
|
||||
);
|
||||
|
||||
if (boolArg('pub')) {
|
||||
await pub.get(
|
||||
context: PubContext.createPlugin,
|
||||
directory: directory.path,
|
||||
offline: boolArg('offline'),
|
||||
generateSyntheticPackage: false,
|
||||
);
|
||||
}
|
||||
|
||||
final FlutterProject project = FlutterProject.fromDirectory(directory);
|
||||
final bool generateAndroid = templateContext['android'] == true;
|
||||
if (generateAndroid) {
|
||||
gradle.updateLocalProperties(project: project, requireAndroidSdk: false);
|
||||
}
|
||||
|
||||
final String projectName = templateContext['projectName'] as String;
|
||||
final String organization = templateContext['organization'] as String;
|
||||
final String androidPluginIdentifier = templateContext['androidIdentifier'] as String;
|
||||
final String exampleProjectName = '${projectName}_example';
|
||||
templateContext['projectName'] = exampleProjectName;
|
||||
templateContext['androidIdentifier'] = CreateBase.createAndroidIdentifier(organization, exampleProjectName);
|
||||
templateContext['iosIdentifier'] = CreateBase.createUTIIdentifier(organization, exampleProjectName);
|
||||
templateContext['macosIdentifier'] = CreateBase.createUTIIdentifier(organization, exampleProjectName);
|
||||
templateContext['windowsIdentifier'] = CreateBase.createWindowsIdentifier(organization, exampleProjectName);
|
||||
templateContext['description'] = 'Demonstrates how to use the $projectName plugin.';
|
||||
templateContext['pluginProjectName'] = projectName;
|
||||
templateContext['androidPluginIdentifier'] = androidPluginIdentifier;
|
||||
|
||||
generatedCount += await generateApp(
|
||||
'app',
|
||||
project.example.directory,
|
||||
templateContext,
|
||||
overwrite: overwrite,
|
||||
pluginExampleApp: true,
|
||||
printStatusWhenWriting: printStatusWhenWriting,
|
||||
);
|
||||
return generatedCount;
|
||||
}
|
||||
|
||||
// Takes an application template and replaces the main.dart with one from the
|
||||
// documentation website in sampleCode. Returns the difference in the number
|
||||
// of files after applying the sample, since it also deletes the application's
|
||||
|
||||
@@ -339,8 +339,7 @@ abstract class CreateBase extends FlutterCommand {
|
||||
String agpVersion,
|
||||
String kotlinVersion,
|
||||
String gradleVersion,
|
||||
bool withPlatformChannelPluginHook = false,
|
||||
bool withFfiPluginHook = false,
|
||||
bool withPluginHook = false,
|
||||
bool ios = false,
|
||||
bool android = false,
|
||||
bool web = false,
|
||||
@@ -385,9 +384,7 @@ abstract class CreateBase extends FlutterCommand {
|
||||
'pluginClassCapitalSnakeCase': pluginClassCapitalSnakeCase,
|
||||
'pluginDartClass': pluginDartClass,
|
||||
'pluginProjectUUID': const Uuid().v4().toUpperCase(),
|
||||
'withFfiPluginHook': withFfiPluginHook,
|
||||
'withPlatformChannelPluginHook': withPlatformChannelPluginHook,
|
||||
'withPluginHook': withFfiPluginHook || withPlatformChannelPluginHook,
|
||||
'withPluginHook': withPluginHook,
|
||||
'androidLanguage': androidLanguage,
|
||||
'iosLanguage': iosLanguage,
|
||||
'hasIosDevelopmentTeam': iosDevelopmentTeam != null && iosDevelopmentTeam.isNotEmpty,
|
||||
|
||||
@@ -259,9 +259,9 @@ const String _androidPluginRegistryTemplateOldEmbedding = '''
|
||||
package io.flutter.plugins;
|
||||
|
||||
import io.flutter.plugin.common.PluginRegistry;
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
import {{package}}.{{class}};
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
|
||||
/**
|
||||
* Generated file. Do not edit.
|
||||
@@ -271,9 +271,9 @@ public final class GeneratedPluginRegistrant {
|
||||
if (alreadyRegisteredWith(registry)) {
|
||||
return;
|
||||
}
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
{{class}}.registerWith(registry.registrarFor("{{package}}.{{class}}"));
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
}
|
||||
|
||||
private static boolean alreadyRegisteredWith(PluginRegistry registry) {
|
||||
@@ -311,7 +311,7 @@ public final class GeneratedPluginRegistrant {
|
||||
{{#needsShim}}
|
||||
ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine);
|
||||
{{/needsShim}}
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
{{#supportsEmbeddingV2}}
|
||||
try {
|
||||
flutterEngine.getPlugins().add(new {{package}}.{{class}}());
|
||||
@@ -328,7 +328,7 @@ public final class GeneratedPluginRegistrant {
|
||||
}
|
||||
{{/supportsEmbeddingV1}}
|
||||
{{/supportsEmbeddingV2}}
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
}
|
||||
}
|
||||
''';
|
||||
@@ -352,11 +352,12 @@ AndroidEmbeddingVersion _getAndroidEmbeddingVersion(FlutterProject project) {
|
||||
}
|
||||
|
||||
Future<void> _writeAndroidPluginRegistrant(FlutterProject project, List<Plugin> plugins) async {
|
||||
final List<Plugin> methodChannelPlugins = _filterMethodChannelPlugins(plugins, AndroidPlugin.kConfigKey);
|
||||
final List<Map<String, Object?>> androidPlugins = _extractPlatformMaps(methodChannelPlugins, AndroidPlugin.kConfigKey);
|
||||
final List<Plugin> nativePlugins = _filterNativePlugins(plugins, AndroidPlugin.kConfigKey);
|
||||
final List<Map<String, Object?>> androidPlugins =
|
||||
_extractPlatformMaps(nativePlugins, AndroidPlugin.kConfigKey);
|
||||
|
||||
final Map<String, Object> templateContext = <String, Object>{
|
||||
'methodChannelPlugins': androidPlugins,
|
||||
'plugins': androidPlugins,
|
||||
'androidX': isAppUsingAndroidX(project.android.hostAppGradleRoot),
|
||||
};
|
||||
final String javaSourcePath = globals.fs.path.join(
|
||||
@@ -473,20 +474,20 @@ const String _objcPluginRegistryImplementationTemplate = '''
|
||||
|
||||
#import "GeneratedPluginRegistrant.h"
|
||||
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
#if __has_include(<{{name}}/{{class}}.h>)
|
||||
#import <{{name}}/{{class}}.h>
|
||||
#else
|
||||
@import {{name}};
|
||||
#endif
|
||||
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
@implementation GeneratedPluginRegistrant
|
||||
|
||||
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
[{{prefix}}{{class}} registerWithRegistrar:[registry registrarForPlugin:@"{{prefix}}{{class}}"]];
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -500,14 +501,14 @@ const String _swiftPluginRegistryTemplate = '''
|
||||
import {{framework}}
|
||||
import Foundation
|
||||
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
import {{name}}
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
{{class}}.register(with: registry.registrar(forPlugin: "{{class}}"))
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -533,9 +534,9 @@ Depends on all your plugins, and provides a function to register them.
|
||||
s.static_framework = true
|
||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
||||
s.dependency '{{framework}}'
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
s.dependency '{{name}}'
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
end
|
||||
''';
|
||||
|
||||
@@ -547,17 +548,17 @@ const String _dartPluginRegistryTemplate = '''
|
||||
// ignore_for_file: directives_ordering
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
import 'package:{{name}}/{{file}}';
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
|
||||
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
|
||||
|
||||
// ignore: public_member_api_docs
|
||||
void registerPlugins(Registrar registrar) {
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
{{class}}.registerWith(registrar);
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
registrar.registerMessageHandler();
|
||||
}
|
||||
''';
|
||||
@@ -589,15 +590,15 @@ const String _cppPluginRegistryImplementationTemplate = '''
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
#include <{{name}}/{{filename}}.h>
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
{{class}}RegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("{{class}}"));
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -628,16 +629,16 @@ const String _linuxPluginRegistryImplementationTemplate = '''
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
#include <{{name}}/{{filename}}.h>
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
g_autoptr(FlPluginRegistrar) {{name}}_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "{{class}}");
|
||||
{{filename}}_register_with_registrar({{name}}_registrar);
|
||||
{{/methodChannelPlugins}}
|
||||
{{/plugins}}
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -647,15 +648,9 @@ const String _pluginCmakefileTemplate = r'''
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
{{#methodChannelPlugins}}
|
||||
{{#plugins}}
|
||||
{{name}}
|
||||
{{/methodChannelPlugins}}
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
{{#ffiPlugins}}
|
||||
{{name}}
|
||||
{{/ffiPlugins}}
|
||||
{{/plugins}}
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
@@ -666,11 +661,6 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||
endforeach(plugin)
|
||||
|
||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||
add_subdirectory({{pluginsDir}}/${ffi_plugin}/{{os}} plugins/${ffi_plugin})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||
endforeach(ffi_plugin)
|
||||
''';
|
||||
|
||||
const String _dartPluginRegisterWith = r'''
|
||||
@@ -759,13 +749,13 @@ void main(List<String> args) {
|
||||
''';
|
||||
|
||||
Future<void> _writeIOSPluginRegistrant(FlutterProject project, List<Plugin> plugins) async {
|
||||
final List<Plugin> methodChannelPlugins = _filterMethodChannelPlugins(plugins, IOSPlugin.kConfigKey);
|
||||
final List<Map<String, Object?>> iosPlugins = _extractPlatformMaps(methodChannelPlugins, IOSPlugin.kConfigKey);
|
||||
final List<Plugin> nativePlugins = _filterNativePlugins(plugins, IOSPlugin.kConfigKey);
|
||||
final List<Map<String, Object?>> iosPlugins = _extractPlatformMaps(nativePlugins, IOSPlugin.kConfigKey);
|
||||
final Map<String, Object> context = <String, Object>{
|
||||
'os': 'ios',
|
||||
'deploymentTarget': '9.0',
|
||||
'framework': 'Flutter',
|
||||
'methodChannelPlugins': iosPlugins,
|
||||
'plugins': iosPlugins,
|
||||
};
|
||||
if (project.isModule) {
|
||||
final Directory registryDirectory = project.ios.pluginRegistrantHost;
|
||||
@@ -809,14 +799,11 @@ String _cmakeRelativePluginSymlinkDirectoryPath(CmakeBasedProject project) {
|
||||
}
|
||||
|
||||
Future<void> _writeLinuxPluginFiles(FlutterProject project, List<Plugin> plugins) async {
|
||||
final List<Plugin> methodChannelPlugins = _filterMethodChannelPlugins(plugins, LinuxPlugin.kConfigKey);
|
||||
final List<Map<String, Object?>> linuxMethodChannelPlugins = _extractPlatformMaps(methodChannelPlugins, LinuxPlugin.kConfigKey);
|
||||
final List<Plugin> ffiPlugins = _filterFfiPlugins(plugins, LinuxPlugin.kConfigKey)..removeWhere(methodChannelPlugins.contains);
|
||||
final List<Map<String, Object?>> linuxFfiPlugins = _extractPlatformMaps(ffiPlugins, LinuxPlugin.kConfigKey);
|
||||
final List<Plugin>nativePlugins = _filterNativePlugins(plugins, LinuxPlugin.kConfigKey);
|
||||
final List<Map<String, Object?>> linuxPlugins = _extractPlatformMaps(nativePlugins, LinuxPlugin.kConfigKey);
|
||||
final Map<String, Object> context = <String, Object>{
|
||||
'os': 'linux',
|
||||
'methodChannelPlugins': linuxMethodChannelPlugins,
|
||||
'ffiPlugins': linuxFfiPlugins,
|
||||
'plugins': linuxPlugins,
|
||||
'pluginsDir': _cmakeRelativePluginSymlinkDirectoryPath(project.linux),
|
||||
};
|
||||
await _writeLinuxPluginRegistrant(project.linux.managedDirectory, context);
|
||||
@@ -848,12 +835,12 @@ Future<void> _writePluginCmakefile(File destinationFile, Map<String, Object> tem
|
||||
}
|
||||
|
||||
Future<void> _writeMacOSPluginRegistrant(FlutterProject project, List<Plugin> plugins) async {
|
||||
final List<Plugin> methodChannelPlugins = _filterMethodChannelPlugins(plugins, MacOSPlugin.kConfigKey);
|
||||
final List<Map<String, Object?>> macosMethodChannelPlugins = _extractPlatformMaps(methodChannelPlugins, MacOSPlugin.kConfigKey);
|
||||
final List<Plugin>nativePlugins = _filterNativePlugins(plugins, MacOSPlugin.kConfigKey);
|
||||
final List<Map<String, Object?>> macosPlugins = _extractPlatformMaps(nativePlugins, MacOSPlugin.kConfigKey);
|
||||
final Map<String, Object> context = <String, Object>{
|
||||
'os': 'macos',
|
||||
'framework': 'FlutterMacOS',
|
||||
'methodChannelPlugins': macosMethodChannelPlugins,
|
||||
'plugins': macosPlugins,
|
||||
};
|
||||
_renderTemplateToFile(
|
||||
_swiftPluginRegistryTemplate,
|
||||
@@ -863,15 +850,15 @@ Future<void> _writeMacOSPluginRegistrant(FlutterProject project, List<Plugin> pl
|
||||
);
|
||||
}
|
||||
|
||||
/// Filters out any plugins that don't use method channels, and thus shouldn't be added to the native generated registrants.
|
||||
List<Plugin> _filterMethodChannelPlugins(List<Plugin> plugins, String platformKey) {
|
||||
/// Filters out Dart-only plugins, which shouldn't be added to the native generated registrants.
|
||||
List<Plugin> _filterNativePlugins(List<Plugin> plugins, String platformKey) {
|
||||
return plugins.where((Plugin element) {
|
||||
final PluginPlatform? plugin = element.platforms[platformKey];
|
||||
if (plugin == null) {
|
||||
return false;
|
||||
}
|
||||
if (plugin is NativeOrDartPlugin) {
|
||||
return (plugin as NativeOrDartPlugin).hasMethodChannel();
|
||||
return (plugin as NativeOrDartPlugin).isNative();
|
||||
}
|
||||
// Not all platforms have the ability to create Dart-only plugins. Therefore, any plugin that doesn't
|
||||
// implement NativeOrDartPlugin is always native.
|
||||
@@ -879,23 +866,6 @@ List<Plugin> _filterMethodChannelPlugins(List<Plugin> plugins, String platformKe
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/// Filters out Dart-only and method channel plugins.
|
||||
///
|
||||
/// FFI Plugins do not need to be registered, but their binaries need to be bundled.
|
||||
List<Plugin> _filterFfiPlugins(List<Plugin> plugins, String platformKey) {
|
||||
return plugins.where((Plugin element) {
|
||||
final PluginPlatform? plugin = element.platforms[platformKey];
|
||||
if (plugin == null) {
|
||||
return false;
|
||||
}
|
||||
if (plugin is NativeOrDartPlugin) {
|
||||
final NativeOrDartPlugin plugin_ = plugin as NativeOrDartPlugin;
|
||||
return plugin_.hasFfi();
|
||||
}
|
||||
return false;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/// Returns only the plugins with the given platform variant.
|
||||
List<Plugin> _filterPluginsByVariant(List<Plugin> plugins, String platformKey, PluginPlatformVariant variant) {
|
||||
return plugins.where((Plugin element) {
|
||||
@@ -911,15 +881,12 @@ List<Plugin> _filterPluginsByVariant(List<Plugin> plugins, String platformKey, P
|
||||
|
||||
@visibleForTesting
|
||||
Future<void> writeWindowsPluginFiles(FlutterProject project, List<Plugin> plugins, TemplateRenderer templateRenderer) async {
|
||||
final List<Plugin> methodChannelPlugins = _filterMethodChannelPlugins(plugins, WindowsPlugin.kConfigKey);
|
||||
final List<Plugin> win32Plugins = _filterPluginsByVariant(methodChannelPlugins, WindowsPlugin.kConfigKey, PluginPlatformVariant.win32);
|
||||
final List<Map<String, Object?>> windowsMethodChannelPlugins = _extractPlatformMaps(win32Plugins, WindowsPlugin.kConfigKey);
|
||||
final List<Plugin> ffiPlugins = _filterFfiPlugins(plugins, WindowsPlugin.kConfigKey)..removeWhere(methodChannelPlugins.contains);
|
||||
final List<Map<String, Object?>> windowsFfiPlugins = _extractPlatformMaps(ffiPlugins, WindowsPlugin.kConfigKey);
|
||||
final List<Plugin> nativePlugins = _filterNativePlugins(plugins, WindowsPlugin.kConfigKey);
|
||||
final List<Plugin> win32Plugins = _filterPluginsByVariant(nativePlugins, WindowsPlugin.kConfigKey, PluginPlatformVariant.win32);
|
||||
final List<Map<String, Object?>> pluginInfo = _extractPlatformMaps(win32Plugins, WindowsPlugin.kConfigKey);
|
||||
final Map<String, Object> context = <String, Object>{
|
||||
'os': 'windows',
|
||||
'methodChannelPlugins': windowsMethodChannelPlugins,
|
||||
'ffiPlugins': windowsFfiPlugins,
|
||||
'plugins': pluginInfo,
|
||||
'pluginsDir': _cmakeRelativePluginSymlinkDirectoryPath(project.windows),
|
||||
};
|
||||
await _writeCppPluginRegistrant(project.windows.managedDirectory, context, templateRenderer);
|
||||
@@ -930,15 +897,12 @@ Future<void> writeWindowsPluginFiles(FlutterProject project, List<Plugin> plugin
|
||||
/// filtering, for the purposes of tooling support and initial UWP bootstrap.
|
||||
@visibleForTesting
|
||||
Future<void> writeWindowsUwpPluginFiles(FlutterProject project, List<Plugin> plugins, TemplateRenderer templateRenderer) async {
|
||||
final List<Plugin> methodChannelPlugins = _filterMethodChannelPlugins(plugins, WindowsPlugin.kConfigKey);
|
||||
final List<Plugin> uwpPlugins = _filterPluginsByVariant(methodChannelPlugins, WindowsPlugin.kConfigKey, PluginPlatformVariant.winuwp);
|
||||
final List<Map<String, Object?>> windowsMethodChannelPlugins = _extractPlatformMaps(uwpPlugins, WindowsPlugin.kConfigKey);
|
||||
final List<Plugin> ffiPlugins = _filterFfiPlugins(plugins, WindowsPlugin.kConfigKey)..removeWhere(methodChannelPlugins.contains);
|
||||
final List<Map<String, Object?>> windowsFfiPlugins = _extractPlatformMaps(ffiPlugins, WindowsPlugin.kConfigKey);
|
||||
final List<Plugin> nativePlugins = _filterNativePlugins(plugins, WindowsPlugin.kConfigKey);
|
||||
final List<Plugin> uwpPlugins = _filterPluginsByVariant(nativePlugins, WindowsPlugin.kConfigKey, PluginPlatformVariant.winuwp);
|
||||
final List<Map<String, Object?>> pluginInfo = _extractPlatformMaps(uwpPlugins, WindowsPlugin.kConfigKey);
|
||||
final Map<String, Object> context = <String, Object>{
|
||||
'os': 'windows',
|
||||
'methodChannelPlugins': windowsMethodChannelPlugins,
|
||||
'ffiPlugins': windowsFfiPlugins,
|
||||
'plugins': pluginInfo,
|
||||
'pluginsDir': _cmakeRelativePluginSymlinkDirectoryPath(project.windowsUwp),
|
||||
};
|
||||
await _writeCppPluginRegistrant(project.windowsUwp.managedDirectory, context, templateRenderer);
|
||||
@@ -963,7 +927,7 @@ Future<void> _writeCppPluginRegistrant(Directory destination, Map<String, Object
|
||||
Future<void> _writeWebPluginRegistrant(FlutterProject project, List<Plugin> plugins) async {
|
||||
final List<Map<String, Object?>> webPlugins = _extractPlatformMaps(plugins, WebPlugin.kConfigKey);
|
||||
final Map<String, Object> context = <String, Object>{
|
||||
'methodChannelPlugins': webPlugins,
|
||||
'plugins': webPlugins,
|
||||
};
|
||||
final File pluginFile = project.web.libDirectory.childFile('generated_plugin_registrant.dart');
|
||||
if (webPlugins.isEmpty) {
|
||||
|
||||
@@ -23,14 +23,9 @@ enum FlutterProjectType {
|
||||
package,
|
||||
/// This is a native plugin project.
|
||||
plugin,
|
||||
/// This is an FFI native plugin project.
|
||||
ffiPlugin,
|
||||
}
|
||||
|
||||
String flutterProjectTypeToString(FlutterProjectType type) {
|
||||
if (type == FlutterProjectType.ffiPlugin) {
|
||||
return 'plugin_ffi';
|
||||
}
|
||||
return getEnumName(type);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,9 @@ import 'base/file_system.dart';
|
||||
/// Constant for 'pluginClass' key in plugin maps.
|
||||
const String kPluginClass = 'pluginClass';
|
||||
|
||||
/// Constant for 'dartPluginClass' key in plugin maps.
|
||||
/// Constant for 'pluginClass' key in plugin maps.
|
||||
const String kDartPluginClass = 'dartPluginClass';
|
||||
|
||||
/// Constant for 'ffiPlugin' key in plugin maps.
|
||||
const String kFfiPlugin = 'ffiPlugin';
|
||||
|
||||
// Constant for 'defaultPackage' key in plugin maps.
|
||||
const String kDefaultPackage = 'default_package';
|
||||
|
||||
@@ -45,14 +42,9 @@ abstract class VariantPlatformPlugin {
|
||||
}
|
||||
|
||||
abstract class NativeOrDartPlugin {
|
||||
/// Determines whether the plugin has a Dart implementation.
|
||||
bool hasDart();
|
||||
|
||||
/// Determines whether the plugin has a FFI implementation.
|
||||
bool hasFfi();
|
||||
|
||||
/// Determines whether the plugin has a method channel implementation.
|
||||
bool hasMethodChannel();
|
||||
/// Determines whether the plugin has a native implementation or if it's a
|
||||
/// Dart-only plugin.
|
||||
bool isNative();
|
||||
}
|
||||
|
||||
/// Contains parameters to template an Android plugin.
|
||||
@@ -72,7 +64,6 @@ class AndroidPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
this.package,
|
||||
this.pluginClass,
|
||||
this.dartPluginClass,
|
||||
this.ffiPlugin,
|
||||
this.defaultPackage,
|
||||
required FileSystem fileSystem,
|
||||
}) : _fileSystem = fileSystem;
|
||||
@@ -84,7 +75,6 @@ class AndroidPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
package: yaml['package'] as String?,
|
||||
pluginClass: yaml[kPluginClass] as String?,
|
||||
dartPluginClass: yaml[kDartPluginClass] as String?,
|
||||
ffiPlugin: yaml[kFfiPlugin] as bool?,
|
||||
defaultPackage: yaml[kDefaultPackage] as String?,
|
||||
pluginPath: pluginPath,
|
||||
fileSystem: fileSystem,
|
||||
@@ -94,22 +84,15 @@ class AndroidPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
final FileSystem _fileSystem;
|
||||
|
||||
@override
|
||||
bool hasMethodChannel() => pluginClass != null;
|
||||
|
||||
@override
|
||||
bool hasFfi() => ffiPlugin == true;
|
||||
|
||||
@override
|
||||
bool hasDart() => dartPluginClass != null;
|
||||
bool isNative() => pluginClass != null;
|
||||
|
||||
static bool validate(YamlMap yaml) {
|
||||
if (yaml == null) {
|
||||
return false;
|
||||
}
|
||||
return (yaml['package'] is String && yaml[kPluginClass] is String) ||
|
||||
yaml[kDartPluginClass] is String ||
|
||||
yaml[kFfiPlugin] == true ||
|
||||
yaml[kDefaultPackage] is String;
|
||||
return (yaml['package'] is String && yaml['pluginClass'] is String)||
|
||||
yaml[kDartPluginClass] is String ||
|
||||
yaml[kDefaultPackage] is String;
|
||||
}
|
||||
|
||||
static const String kConfigKey = 'android';
|
||||
@@ -126,9 +109,6 @@ class AndroidPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
/// The Dart plugin main class defined in pubspec.yaml, if any.
|
||||
final String? dartPluginClass;
|
||||
|
||||
/// Is FFI plugin defined in pubspec.yaml, if any.
|
||||
final bool? ffiPlugin;
|
||||
|
||||
/// The default implementation package defined in pubspec.yaml, if any.
|
||||
final String? defaultPackage;
|
||||
|
||||
@@ -234,7 +214,6 @@ class IOSPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
required this.classPrefix,
|
||||
this.pluginClass,
|
||||
this.dartPluginClass,
|
||||
this.ffiPlugin,
|
||||
this.defaultPackage,
|
||||
});
|
||||
|
||||
@@ -245,7 +224,6 @@ class IOSPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
classPrefix: '',
|
||||
pluginClass: yaml[kPluginClass] as String?,
|
||||
dartPluginClass: yaml[kDartPluginClass] as String?,
|
||||
ffiPlugin: yaml[kFfiPlugin] as bool?,
|
||||
defaultPackage: yaml[kDefaultPackage] as String?,
|
||||
);
|
||||
}
|
||||
@@ -255,9 +233,8 @@ class IOSPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
return false;
|
||||
}
|
||||
return yaml[kPluginClass] is String ||
|
||||
yaml[kDartPluginClass] is String ||
|
||||
yaml[kFfiPlugin] == true ||
|
||||
yaml[kDefaultPackage] is String;
|
||||
yaml[kDartPluginClass] is String ||
|
||||
yaml[kDefaultPackage] is String;
|
||||
}
|
||||
|
||||
static const String kConfigKey = 'ios';
|
||||
@@ -269,17 +246,10 @@ class IOSPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
final String classPrefix;
|
||||
final String? pluginClass;
|
||||
final String? dartPluginClass;
|
||||
final bool? ffiPlugin;
|
||||
final String? defaultPackage;
|
||||
|
||||
@override
|
||||
bool hasMethodChannel() => pluginClass != null;
|
||||
|
||||
@override
|
||||
bool hasFfi() => ffiPlugin == true;
|
||||
|
||||
@override
|
||||
bool hasDart() => dartPluginClass != null;
|
||||
bool isNative() => pluginClass != null;
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toMap() {
|
||||
@@ -288,7 +258,6 @@ class IOSPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
'prefix': classPrefix,
|
||||
if (pluginClass != null) 'class': pluginClass,
|
||||
if (dartPluginClass != null) kDartPluginClass : dartPluginClass,
|
||||
if (ffiPlugin != null) kFfiPlugin: ffiPlugin,
|
||||
if (defaultPackage != null) kDefaultPackage : defaultPackage,
|
||||
};
|
||||
}
|
||||
@@ -296,15 +265,13 @@ class IOSPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
|
||||
/// Contains the parameters to template a macOS plugin.
|
||||
///
|
||||
/// The [name] of the plugin is required. Either [dartPluginClass] or
|
||||
/// [pluginClass] or [ffiPlugin] are required.
|
||||
/// The [name] of the plugin is required. Either [dartPluginClass] or [pluginClass] are required.
|
||||
/// [pluginClass] will be the entry point to the plugin's native code.
|
||||
class MacOSPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
const MacOSPlugin({
|
||||
required this.name,
|
||||
this.pluginClass,
|
||||
this.dartPluginClass,
|
||||
this.ffiPlugin,
|
||||
this.defaultPackage,
|
||||
});
|
||||
|
||||
@@ -319,7 +286,6 @@ class MacOSPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
name: name,
|
||||
pluginClass: pluginClass,
|
||||
dartPluginClass: yaml[kDartPluginClass] as String?,
|
||||
ffiPlugin: yaml[kFfiPlugin] as bool?,
|
||||
defaultPackage: yaml[kDefaultPackage] as String?,
|
||||
);
|
||||
}
|
||||
@@ -329,9 +295,8 @@ class MacOSPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
return false;
|
||||
}
|
||||
return yaml[kPluginClass] is String ||
|
||||
yaml[kDartPluginClass] is String ||
|
||||
yaml[kFfiPlugin] == true ||
|
||||
yaml[kDefaultPackage] is String;
|
||||
yaml[kDartPluginClass] is String ||
|
||||
yaml[kDefaultPackage] is String;
|
||||
}
|
||||
|
||||
static const String kConfigKey = 'macos';
|
||||
@@ -339,26 +304,18 @@ class MacOSPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
final String name;
|
||||
final String? pluginClass;
|
||||
final String? dartPluginClass;
|
||||
final bool? ffiPlugin;
|
||||
final String? defaultPackage;
|
||||
|
||||
@override
|
||||
bool hasMethodChannel() => pluginClass != null;
|
||||
|
||||
@override
|
||||
bool hasFfi() => ffiPlugin == true;
|
||||
|
||||
@override
|
||||
bool hasDart() => dartPluginClass != null;
|
||||
bool isNative() => pluginClass != null;
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toMap() {
|
||||
return <String, dynamic>{
|
||||
'name': name,
|
||||
if (pluginClass != null) 'class': pluginClass,
|
||||
if (dartPluginClass != null) kDartPluginClass: dartPluginClass,
|
||||
if (ffiPlugin != null) kFfiPlugin: ffiPlugin,
|
||||
if (defaultPackage != null) kDefaultPackage: defaultPackage,
|
||||
if (dartPluginClass != null) kDartPluginClass : dartPluginClass,
|
||||
if (defaultPackage != null) kDefaultPackage : defaultPackage,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -367,13 +324,11 @@ class MacOSPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
///
|
||||
/// The [name] of the plugin is required. Either [dartPluginClass] or [pluginClass] are required.
|
||||
/// [pluginClass] will be the entry point to the plugin's native code.
|
||||
class WindowsPlugin extends PluginPlatform
|
||||
implements NativeOrDartPlugin, VariantPlatformPlugin {
|
||||
class WindowsPlugin extends PluginPlatform implements NativeOrDartPlugin, VariantPlatformPlugin {
|
||||
const WindowsPlugin({
|
||||
required this.name,
|
||||
this.pluginClass,
|
||||
this.dartPluginClass,
|
||||
this.ffiPlugin,
|
||||
this.defaultPackage,
|
||||
this.variants = const <PluginPlatformVariant>{},
|
||||
}) : assert(pluginClass != null || dartPluginClass != null || defaultPackage != null);
|
||||
@@ -408,7 +363,6 @@ class WindowsPlugin extends PluginPlatform
|
||||
name: name,
|
||||
pluginClass: pluginClass,
|
||||
dartPluginClass: yaml[kDartPluginClass] as String?,
|
||||
ffiPlugin: yaml[kFfiPlugin] as bool?,
|
||||
defaultPackage: yaml[kDefaultPackage] as String?,
|
||||
variants: variants,
|
||||
);
|
||||
@@ -420,9 +374,8 @@ class WindowsPlugin extends PluginPlatform
|
||||
}
|
||||
|
||||
return yaml[kPluginClass] is String ||
|
||||
yaml[kDartPluginClass] is String ||
|
||||
yaml[kFfiPlugin] == true ||
|
||||
yaml[kDefaultPackage] is String;
|
||||
yaml[kDartPluginClass] is String ||
|
||||
yaml[kDefaultPackage] is String;
|
||||
}
|
||||
|
||||
static const String kConfigKey = 'windows';
|
||||
@@ -430,7 +383,6 @@ class WindowsPlugin extends PluginPlatform
|
||||
final String name;
|
||||
final String? pluginClass;
|
||||
final String? dartPluginClass;
|
||||
final bool? ffiPlugin;
|
||||
final String? defaultPackage;
|
||||
final Set<PluginPlatformVariant> variants;
|
||||
|
||||
@@ -438,13 +390,7 @@ class WindowsPlugin extends PluginPlatform
|
||||
Set<PluginPlatformVariant> get supportedVariants => variants;
|
||||
|
||||
@override
|
||||
bool hasMethodChannel() => pluginClass != null;
|
||||
|
||||
@override
|
||||
bool hasFfi() => ffiPlugin == true;
|
||||
|
||||
@override
|
||||
bool hasDart() => dartPluginClass != null;
|
||||
bool isNative() => pluginClass != null;
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toMap() {
|
||||
@@ -467,12 +413,8 @@ class LinuxPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
required this.name,
|
||||
this.pluginClass,
|
||||
this.dartPluginClass,
|
||||
this.ffiPlugin,
|
||||
this.defaultPackage,
|
||||
}) : assert(pluginClass != null ||
|
||||
dartPluginClass != null ||
|
||||
ffiPlugin == true ||
|
||||
defaultPackage != null);
|
||||
}) : assert(pluginClass != null || dartPluginClass != null || defaultPackage != null);
|
||||
|
||||
factory LinuxPlugin.fromYaml(String name, YamlMap yaml) {
|
||||
assert(validate(yaml));
|
||||
@@ -485,7 +427,6 @@ class LinuxPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
name: name,
|
||||
pluginClass: pluginClass,
|
||||
dartPluginClass: yaml[kDartPluginClass] as String?,
|
||||
ffiPlugin: yaml[kFfiPlugin] as bool?,
|
||||
defaultPackage: yaml[kDefaultPackage] as String?,
|
||||
);
|
||||
}
|
||||
@@ -495,9 +436,8 @@ class LinuxPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
return false;
|
||||
}
|
||||
return yaml[kPluginClass] is String ||
|
||||
yaml[kDartPluginClass] is String ||
|
||||
yaml[kFfiPlugin] == true ||
|
||||
yaml[kDefaultPackage] is String;
|
||||
yaml[kDartPluginClass] is String ||
|
||||
yaml[kDefaultPackage] is String;
|
||||
}
|
||||
|
||||
static const String kConfigKey = 'linux';
|
||||
@@ -505,17 +445,10 @@ class LinuxPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
final String name;
|
||||
final String? pluginClass;
|
||||
final String? dartPluginClass;
|
||||
final bool? ffiPlugin;
|
||||
final String? defaultPackage;
|
||||
|
||||
@override
|
||||
bool hasMethodChannel() => pluginClass != null;
|
||||
|
||||
@override
|
||||
bool hasFfi() => ffiPlugin == true;
|
||||
|
||||
@override
|
||||
bool hasDart() => dartPluginClass != null;
|
||||
bool isNative() => pluginClass != null;
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toMap() {
|
||||
|
||||
@@ -47,17 +47,12 @@ class Plugin {
|
||||
/// package: io.flutter.plugins.sample
|
||||
/// pluginClass: SamplePlugin
|
||||
/// ios:
|
||||
/// # A plugin implemented through method channels.
|
||||
/// pluginClass: SamplePlugin
|
||||
/// linux:
|
||||
/// # A plugin implemented purely in Dart code.
|
||||
/// dartPluginClass: SamplePlugin
|
||||
/// pluginClass: SamplePlugin
|
||||
/// macos:
|
||||
/// # A plugin implemented `dart:ffi`.
|
||||
/// ffiPlugin: true
|
||||
/// pluginClass: SamplePlugin
|
||||
/// windows:
|
||||
/// # A plugin using platform-specific Dart and method channels.
|
||||
/// dartPluginClass: SamplePlugin
|
||||
/// pluginClass: SamplePlugin
|
||||
factory Plugin.fromYaml(
|
||||
String name,
|
||||
|
||||
Reference in New Issue
Block a user