FFI plugins (#96225)
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
This directory contains templates for `flutter create`.
|
||||
|
||||
The `app_shared` subdirectory is special. It provides files for all app
|
||||
templates (as opposed to plugin or module templates).
|
||||
As of May 2021, there are two app templates: `app` (the counter app)
|
||||
The `*_shared` subdirectories provide files for multiple templates.
|
||||
|
||||
* `app_shared` for `app` and `skeleton`.
|
||||
* `plugin_shared` for (method channel) `plugin` and `plugin_ffi`.
|
||||
|
||||
For example, there are two app templates: `app` (the counter app)
|
||||
and `skeleton` (the more advanced list view/detail view app).
|
||||
|
||||
```plain
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
{{#withPluginHook}}
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:{{pluginProjectName}}/{{pluginProjectName}}.dart';
|
||||
{{/withPluginHook}}
|
||||
{{/withPlatformChannelPluginHook}}
|
||||
{{#withFfiPluginHook}}
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:{{pluginProjectName}}/{{pluginProjectName}}.dart' as {{pluginProjectName}};
|
||||
{{/withFfiPluginHook}}
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
@@ -121,7 +126,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
}
|
||||
}
|
||||
{{/withPluginHook}}
|
||||
{{#withPluginHook}}
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@@ -174,4 +179,71 @@ class _MyAppState extends State<MyApp> {
|
||||
);
|
||||
}
|
||||
}
|
||||
{{/withPluginHook}}
|
||||
{{/withPlatformChannelPluginHook}}
|
||||
{{#withFfiPluginHook}}
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyAppState createState() => _MyAppState();
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
late int sumResult;
|
||||
late Future<int> sumAsyncResult;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
sumResult = {{pluginProjectName}}.sum(1, 2);
|
||||
sumAsyncResult = {{pluginProjectName}}.sumAsync(3, 4);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const textStyle = TextStyle(fontSize: 25);
|
||||
const spacerSmall = SizedBox(height: 10);
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Native Packages'),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text(
|
||||
'This calls a native function through FFI that is shipped as source in the package. '
|
||||
'The native code is built as part of the Flutter Runner build.',
|
||||
style: textStyle,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
spacerSmall,
|
||||
Text(
|
||||
'sum(1, 2) = $sumResult',
|
||||
style: textStyle,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
spacerSmall,
|
||||
FutureBuilder<int>(
|
||||
future: sumAsyncResult,
|
||||
builder: (BuildContext context, AsyncSnapshot<int> value) {
|
||||
final displayValue =
|
||||
(value.hasData) ? value.data : 'loading';
|
||||
return Text(
|
||||
'await sumAsync(3, 4) = $displayValue',
|
||||
style: textStyle,
|
||||
textAlign: TextAlign.center,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
{{/withFfiPluginHook}}
|
||||
|
||||
@@ -4,7 +4,7 @@ description: {{description}}
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
{{^withPluginHook}}
|
||||
{{^withPlatformChannelPluginHook}}
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
@@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 1.0.0+1
|
||||
{{/withPluginHook}}
|
||||
{{/withPlatformChannelPluginHook}}
|
||||
|
||||
environment:
|
||||
sdk: {{dartSdkVersionBounds}}
|
||||
|
||||
@@ -27,6 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion flutter.compileSdkVersion
|
||||
ndkVersion flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
|
||||
@@ -27,6 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion flutter.compileSdkVersion
|
||||
ndkVersion flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
|
||||
@@ -116,11 +116,11 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}
|
||||
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||
COMPONENT Runtime)
|
||||
|
||||
if(PLUGIN_BUNDLED_LIBRARIES)
|
||||
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
|
||||
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
|
||||
install(FILES "${bundled_library}"
|
||||
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||
COMPONENT Runtime)
|
||||
endif()
|
||||
endforeach(bundled_library)
|
||||
|
||||
# Fully re-copy the assets directory on each build to avoid having stale files
|
||||
# from a previous install.
|
||||
|
||||
@@ -30,7 +30,7 @@ void main() {
|
||||
});
|
||||
}
|
||||
{{/withPluginHook}}
|
||||
{{#withPluginHook}}
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
void main() {
|
||||
testWidgets('Verify Platform version', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
@@ -46,4 +46,4 @@ void main() {
|
||||
);
|
||||
});
|
||||
}
|
||||
{{/withPluginHook}}
|
||||
{{/withPlatformChannelPluginHook}}
|
||||
@@ -31,6 +31,7 @@ version '1.0'
|
||||
|
||||
android {
|
||||
compileSdkVersion flutter.compileSdkVersion
|
||||
ndkVersion flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
{{#withPluginHook}}
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:{{pluginProjectName}}/{{pluginProjectName}}.dart';
|
||||
{{/withPluginHook}}
|
||||
{{/withPlatformChannelPluginHook}}
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
{{^withPluginHook}}
|
||||
{{^withPlatformChannelPluginHook}}
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@@ -117,8 +117,8 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
);
|
||||
}
|
||||
}
|
||||
{{/withPluginHook}}
|
||||
{{#withPluginHook}}
|
||||
{{/withPlatformChannelPluginHook}}
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@@ -171,4 +171,4 @@ class _MyAppState extends State<MyApp> {
|
||||
);
|
||||
}
|
||||
}
|
||||
{{/withPluginHook}}
|
||||
{{/withPlatformChannelPluginHook}}
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
{{^withFfiPluginHook}}
|
||||
import 'package:{{projectName}}/main.dart';
|
||||
{{/withFfiPluginHook}}
|
||||
|
||||
{{^withPluginHook}}
|
||||
void main() {
|
||||
@@ -30,7 +32,7 @@ void main() {
|
||||
});
|
||||
}
|
||||
{{/withPluginHook}}
|
||||
{{#withPluginHook}}
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
void main() {
|
||||
testWidgets('Verify Platform version', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
@@ -46,4 +48,4 @@ void main() {
|
||||
);
|
||||
});
|
||||
}
|
||||
{{/withPluginHook}}
|
||||
{{/withPlatformChannelPluginHook}}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Dart SDK">
|
||||
<CLASSES>
|
||||
<root url="file://{{{dartSdk}}}/lib/async" />
|
||||
<root url="file://{{{dartSdk}}}/lib/collection" />
|
||||
<root url="file://{{{dartSdk}}}/lib/convert" />
|
||||
<root url="file://{{{dartSdk}}}/lib/core" />
|
||||
<root url="file://{{{dartSdk}}}/lib/developer" />
|
||||
<root url="file://{{{dartSdk}}}/lib/html" />
|
||||
<root url="file://{{{dartSdk}}}/lib/io" />
|
||||
<root url="file://{{{dartSdk}}}/lib/isolate" />
|
||||
<root url="file://{{{dartSdk}}}/lib/math" />
|
||||
<root url="file://{{{dartSdk}}}/lib/mirrors" />
|
||||
<root url="file://{{{dartSdk}}}/lib/typed_data" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/{{projectName}}.iml" filepath="$PROJECT_DIR$/{{projectName}}.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/android/{{projectName}}_android.iml" filepath="$PROJECT_DIR$/android/{{projectName}}_android.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/example/android/{{projectName}}_example_android.iml" filepath="$PROJECT_DIR$/example/android/{{projectName}}_example_android.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,6 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="example/lib/main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
|
||||
<option name="filePath" value="$PROJECT_DIR$/example/lib/main.dart" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file leaf-file-name="{{projectName}}.dart" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/lib/{{projectName}}.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="main.dart" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="ProjectPane">
|
||||
<option name="show-excluded-files" value="false" />
|
||||
</pane>
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="dart.analysis.tool.window.force.activate" value="true" />
|
||||
<property name="show.migrate.to.gradle.popup" value="false" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -15,6 +15,6 @@ samples, guidance on mobile development, and a full API reference.
|
||||
|
||||
{{#no_platforms}}
|
||||
The plugin project was generated without specifying the `--platforms` flag, no platforms are currently supported.
|
||||
To add platforms, run `flutter create -t plugin --platforms <platforms> .` under the same
|
||||
directory. You can also find a detailed instruction on how to add platforms in the `pubspec.yaml` at https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms.
|
||||
To add platforms, run `flutter create -t plugin --platforms <platforms> .` in this directory.
|
||||
You can also find a detailed instruction on how to add platforms in the `pubspec.yaml` at https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms.
|
||||
{{/no_platforms}}
|
||||
|
||||
97
packages/flutter_tools/templates/plugin_ffi/README.md.tmpl
Normal file
97
packages/flutter_tools/templates/plugin_ffi/README.md.tmpl
Normal file
@@ -0,0 +1,97 @@
|
||||
# {{projectName}}
|
||||
|
||||
{{description}}
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter
|
||||
[FFI plugin](https://docs.flutter.dev/development/platform-integration/c-interop),
|
||||
a specialized package that includes native code directly invoked with Dart FFI.
|
||||
|
||||
## Project stucture
|
||||
|
||||
This template uses the following structure:
|
||||
|
||||
* `src`: Contains the native source code, and a CmakeFile.txt file for building
|
||||
that source code into a dynamic library.
|
||||
|
||||
* `lib`: Contains the Dart code that defines the API of the plugin, and which
|
||||
calls into the native code using `dart:ffi`.
|
||||
|
||||
* platform folders (`android`, `ios`, `windows`, etc.): Contains the build files
|
||||
for building and bundling the native code library with the platform application.
|
||||
|
||||
## Buidling and bundling native code
|
||||
|
||||
The `pubspec.yaml` specifies FFI plugins as follows:
|
||||
|
||||
```yaml
|
||||
plugin:
|
||||
platforms:
|
||||
some_platform:
|
||||
ffiPlugin: true
|
||||
```
|
||||
|
||||
This configuration invokes the native build for the various target platforms
|
||||
and bundles the binaries in Flutter applications using these FFI plugins.
|
||||
|
||||
This can be combined with dartPluginClass, such as when FFI is used for the
|
||||
implementation of one platform in a federated plugin:
|
||||
|
||||
```yaml
|
||||
plugin:
|
||||
implements: some_other_plugin
|
||||
platforms:
|
||||
some_platform:
|
||||
dartPluginClass: SomeClass
|
||||
ffiPlugin: true
|
||||
```
|
||||
|
||||
A plugin can have both FFI and method channels:
|
||||
|
||||
```yaml
|
||||
plugin:
|
||||
platforms:
|
||||
some_platform:
|
||||
pluginClass: SomeName
|
||||
ffiPlugin: true
|
||||
```
|
||||
|
||||
The native build systems that are invoked by FFI (and method channel) plugins are:
|
||||
|
||||
* For Android: Gradle, which invokes the Android NDK for native builds.
|
||||
* See the documentation in android/build.gradle.
|
||||
* For iOS and MacOS: Xcode, via CocoaPods.
|
||||
* See the documentation in ios/{{projectName}}.podspec.
|
||||
* See the documentation in macos/{{projectName}}.podspec.
|
||||
* For Linux and Windows: CMake.
|
||||
* See the documentation in linux/CMakeLists.txt.
|
||||
* See the documentation in windows/CMakeLists.txt.
|
||||
|
||||
## Binding to native code
|
||||
|
||||
To use the native code, bindings in Dart are needed.
|
||||
To avoid writing these by hand, they are generated from the header file
|
||||
(`src/{{projectName}}.h`) by `package:ffigen`.
|
||||
Regenerate the bindings by running `flutter pub run ffigen --config ffigen.yaml`.
|
||||
|
||||
## Invoking native code
|
||||
|
||||
Very short-running native functions can be directly invoked from any isolate.
|
||||
For example, see `sum` in `lib/{{projectName}}.dart`.
|
||||
|
||||
Longer-running functions should be invoked on a helper isolate to avoid
|
||||
dropping frames in Flutter applications.
|
||||
For example, see `sumAsync` in `lib/{{projectName}}.dart`.
|
||||
|
||||
## Flutter help
|
||||
|
||||
For help getting started with Flutter, view our
|
||||
[online documentation](https://flutter.dev/docs), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
|
||||
{{#no_platforms}}
|
||||
The plugin project was generated without specifying the `--platforms` flag, so no platforms are currently supported.
|
||||
To add platforms, run `flutter create -t plugin_ffi --platforms <platforms> .` in this directory.
|
||||
You can also find a detailed instruction on how to add platforms in the `pubspec.yaml` at https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms.
|
||||
{{/no_platforms}}
|
||||
@@ -0,0 +1,59 @@
|
||||
// The Android Gradle Plugin builds the native code with the Android NDK.
|
||||
|
||||
group '{{androidIdentifier}}'
|
||||
version '1.0'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// The Android Gradle Plugin knows how to build native code with the NDK.
|
||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
// Bumping the plugin compileSdkVersion requires all clients of this plugin
|
||||
// to bump the version in their app.
|
||||
compileSdkVersion 31
|
||||
|
||||
// Bumping the plugin ndkVersion requires all clients of this plugin to bump
|
||||
// the version in their app and to download a newer version of the NDK.
|
||||
ndkVersion "21.1.6352462"
|
||||
|
||||
// Invoke the shared CMake build with the Android Gradle Plugin.
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "../src/CMakeLists.txt"
|
||||
|
||||
// The default CMake version for the Android Gradle Plugin is 3.10.2.
|
||||
// https://developer.android.com/studio/projects/install-ndk#vanilla_cmake
|
||||
//
|
||||
// The Flutter tooling requires that developers have CMake 3.10 or later
|
||||
// installed. You should not increase this version, as doing so will cause
|
||||
// the plugin to fail to compile for some customers of the plugin.
|
||||
// version "3.10.2"
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/gen" />
|
||||
<option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/gen" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
<option name="LIBS_FOLDER_RELATIVE_PATH" value="/src/main/libs" />
|
||||
<option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/src/main/proguard_logs" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API {{androidSdkVersion}} Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Flutter for Android" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
19
packages/flutter_tools/templates/plugin_ffi/ffigen.yaml.tmpl
Normal file
19
packages/flutter_tools/templates/plugin_ffi/ffigen.yaml.tmpl
Normal file
@@ -0,0 +1,19 @@
|
||||
# Run with `dart run ffigen --config ffigen.yaml`.
|
||||
name: {{pluginDartClass}}Bindings
|
||||
description: |
|
||||
Bindings for `src/{{projectName}}.h`.
|
||||
|
||||
Regenerate bindings with `dart run ffigen --config ffigen.yaml`.
|
||||
output: 'lib/{{projectName}}_bindings_generated.dart'
|
||||
headers:
|
||||
entry-points:
|
||||
- 'src/{{projectName}}.h'
|
||||
include-directives:
|
||||
- 'src/{{projectName}}.h'
|
||||
preamble: |
|
||||
// ignore_for_file: always_specify_types
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
comments:
|
||||
style: any
|
||||
length: full
|
||||
@@ -0,0 +1,3 @@
|
||||
// Relative import to be able to reuse the C sources.
|
||||
// See the comment in ../{projectName}}.podspec for more information.
|
||||
#include "../../src/{{projectName}}.c"
|
||||
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
|
||||
# Run `pod lib lint {{projectName}}.podspec` to validate before publishing.
|
||||
#
|
||||
Pod::Spec.new do |s|
|
||||
s.name = '{{projectName}}'
|
||||
s.version = '0.0.1'
|
||||
s.summary = '{{description}}'
|
||||
s.description = <<-DESC
|
||||
{{description}}
|
||||
DESC
|
||||
s.homepage = 'http://example.com'
|
||||
s.license = { :file => '../LICENSE' }
|
||||
s.author = { 'Your Company' => 'email@example.com' }
|
||||
|
||||
# This will ensure the source files in Classes/ are included in the native
|
||||
# builds of apps using this FFI plugin. Podspec does not support relative
|
||||
# paths, so Classes contains a forwarder C file that relatively imports
|
||||
# `../src/*` so that the C sources can be shared among all target platforms.
|
||||
s.source = { :path => '.' }
|
||||
s.source_files = 'Classes/**/*'
|
||||
s.dependency 'Flutter'
|
||||
s.platform = :ios, '9.0'
|
||||
|
||||
# Flutter.framework does not contain a i386 slice.
|
||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
|
||||
s.swift_version = '5.0'
|
||||
end
|
||||
@@ -0,0 +1,139 @@
|
||||
{{#no_platforms}}
|
||||
// You have generated a new plugin project without specifying the `--platforms`
|
||||
// flag. An FFI plugin project that supports no platforms is generated.
|
||||
// To add platforms, run `flutter create -t plugin_ffi --platforms <platforms> .`
|
||||
// in this directory. You can also find a detailed instruction on how to
|
||||
// add platforms in the `pubspec.yaml` at
|
||||
// https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms.
|
||||
{{/no_platforms}}
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:ffi';
|
||||
import 'dart:io';
|
||||
import 'dart:isolate';
|
||||
|
||||
import '{{projectName}}_bindings_generated.dart';
|
||||
|
||||
/// A very short-lived native function.
|
||||
///
|
||||
/// For very short-lived functions, it is fine to call them on the main isolate.
|
||||
/// They will block the Dart execution while running the native function, so
|
||||
/// only do this for native functions which are guaranteed to be short-lived.
|
||||
int sum(int a, int b) => _bindings.sum(a, b);
|
||||
|
||||
/// A longer lived native function, which occupies the thread calling it.
|
||||
///
|
||||
/// Do not call these kind of native functions in the main isolate. They will
|
||||
/// block Dart execution. This will cause dropped frames in Flutter applications.
|
||||
/// Instead, call these native functions on a separate isolate.
|
||||
///
|
||||
/// Modify this to suit your own use case. Example use cases:
|
||||
///
|
||||
/// 1. Reuse a single isolate for various different kinds of requests.
|
||||
/// 2. Use multiple helper isolates for parallel execution.
|
||||
Future<int> sumAsync(int a, int b) async {
|
||||
final SendPort helperIsolateSendPort = await _helperIsolateSendPort;
|
||||
final int requestId = _nextSumRequestId++;
|
||||
final _SumRequest request = _SumRequest(requestId, a, b);
|
||||
final Completer<int> completer = Completer<int>();
|
||||
_sumRequests[requestId] = completer;
|
||||
helperIsolateSendPort.send(request);
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
const String _libName = '{{projectName}}';
|
||||
|
||||
/// The dynamic library in which the symbols for [{{pluginDartClass}}Bindings] can be found.
|
||||
final DynamicLibrary _dylib = () {
|
||||
if (Platform.isMacOS || Platform.isIOS) {
|
||||
return DynamicLibrary.open('$_libName.framework/$_libName');
|
||||
}
|
||||
if (Platform.isAndroid || Platform.isLinux) {
|
||||
return DynamicLibrary.open('lib$_libName.so');
|
||||
}
|
||||
if (Platform.isWindows) {
|
||||
return DynamicLibrary.open('$_libName.dll');
|
||||
}
|
||||
throw UnsupportedError('Unknown platform: ${Platform.operatingSystem}');
|
||||
}();
|
||||
|
||||
/// The bindings to the native functions in [_dylib].
|
||||
final {{pluginDartClass}}Bindings _bindings = {{pluginDartClass}}Bindings(_dylib);
|
||||
|
||||
|
||||
/// A request to compute `sum`.
|
||||
///
|
||||
/// Typically sent from one isolate to another.
|
||||
class _SumRequest {
|
||||
final int id;
|
||||
final int a;
|
||||
final int b;
|
||||
|
||||
const _SumRequest(this.id, this.a, this.b);
|
||||
}
|
||||
|
||||
/// A response with the result of `sum`.
|
||||
///
|
||||
/// Typically sent from one isolate to another.
|
||||
class _SumResponse {
|
||||
final int id;
|
||||
final int result;
|
||||
|
||||
const _SumResponse(this.id, this.result);
|
||||
}
|
||||
|
||||
/// Counter to identify [_SumRequest]s and [_SumResponse]s.
|
||||
int _nextSumRequestId = 0;
|
||||
|
||||
/// Mapping from [_SumRequest] `id`s to the completers corresponding to the correct future of the pending request.
|
||||
final Map<int, Completer<int>> _sumRequests = <int, Completer<int>>{};
|
||||
|
||||
/// The SendPort belonging to the helper isolate.
|
||||
Future<SendPort> _helperIsolateSendPort = () async {
|
||||
// The helper isolate is going to send us back a SendPort, which we want to
|
||||
// wait for.
|
||||
final Completer<SendPort> completer = Completer<SendPort>();
|
||||
|
||||
// Receive port on the main isolate to receive messages from the helper.
|
||||
// We receive two types of messages:
|
||||
// 1. A port to send messages on.
|
||||
// 2. Responses to requests we sent.
|
||||
final ReceivePort receivePort = ReceivePort()
|
||||
..listen((dynamic data) {
|
||||
if (data is SendPort) {
|
||||
// The helper isolate sent us the port on which we can sent it requests.
|
||||
completer.complete(data);
|
||||
return;
|
||||
}
|
||||
if (data is _SumResponse) {
|
||||
// The helper isolate sent us a response to a request we sent.
|
||||
final Completer<int> completer = _sumRequests[data.id]!;
|
||||
_sumRequests.remove(data.id);
|
||||
completer.complete(data.result);
|
||||
return;
|
||||
}
|
||||
throw UnsupportedError('Unsupported message type: ${data.runtimeType}');
|
||||
});
|
||||
|
||||
// Start the helper isolate.
|
||||
await Isolate.spawn((SendPort sendPort) async {
|
||||
final ReceivePort helperReceivePort = ReceivePort()
|
||||
..listen((dynamic data) {
|
||||
// On the helper isolate listen to requests and respond to them.
|
||||
if (data is _SumRequest) {
|
||||
final int result = _bindings.sum_long_running(data.a, data.b);
|
||||
final _SumResponse response = _SumResponse(data.id, result);
|
||||
sendPort.send(response);
|
||||
return;
|
||||
}
|
||||
throw UnsupportedError('Unsupported message type: ${data.runtimeType}');
|
||||
});
|
||||
|
||||
// Send the the port to the main isolate on which we can receive requests.
|
||||
sendPort.send(helperReceivePort.sendPort);
|
||||
}, receivePort.sendPort);
|
||||
|
||||
// Wait until the helper isolate has sent us back the SendPort on which we
|
||||
// can start sending requests.
|
||||
return completer.future;
|
||||
}();
|
||||
@@ -0,0 +1,69 @@
|
||||
// ignore_for_file: always_specify_types
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
// AUTO GENERATED FILE, DO NOT EDIT.
|
||||
//
|
||||
// Generated by `package:ffigen`.
|
||||
import 'dart:ffi' as ffi;
|
||||
|
||||
/// Bindings for `src/{{projectName}}.h`.
|
||||
///
|
||||
/// Regenerate bindings with `dart run ffigen --config ffigen.yaml`.
|
||||
///
|
||||
class {{pluginDartClass}}Bindings {
|
||||
/// Holds the symbol lookup function.
|
||||
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
||||
_lookup;
|
||||
|
||||
/// The symbols are looked up in [dynamicLibrary].
|
||||
{{pluginDartClass}}Bindings(ffi.DynamicLibrary dynamicLibrary)
|
||||
: _lookup = dynamicLibrary.lookup;
|
||||
|
||||
/// The symbols are looked up with [lookup].
|
||||
{{pluginDartClass}}Bindings.fromLookup(
|
||||
ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
||||
lookup)
|
||||
: _lookup = lookup;
|
||||
|
||||
/// A very short-lived native function.
|
||||
///
|
||||
/// For very short-lived functions, it is fine to call them on the main isolate.
|
||||
/// They will block the Dart execution while running the native function, so
|
||||
/// only do this for native functions which are guaranteed to be short-lived.
|
||||
int sum(
|
||||
int a,
|
||||
int b,
|
||||
) {
|
||||
return _sum(
|
||||
a,
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
late final _sumPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.IntPtr Function(ffi.IntPtr, ffi.IntPtr)>>(
|
||||
'sum');
|
||||
late final _sum = _sumPtr.asFunction<int Function(int, int)>();
|
||||
|
||||
/// A longer lived native function, which occupies the thread calling it.
|
||||
///
|
||||
/// Calling these kind of native functions in the main isolate will
|
||||
/// block Dart execution and cause dropped frames in Flutter applications.
|
||||
/// Consider calling such native functions from a separate isolate.
|
||||
int sum_long_running(
|
||||
int a,
|
||||
int b,
|
||||
) {
|
||||
return _sum_long_running(
|
||||
a,
|
||||
b,
|
||||
);
|
||||
}
|
||||
|
||||
late final _sum_long_runningPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.IntPtr Function(ffi.IntPtr, ffi.IntPtr)>>(
|
||||
'sum_long_running');
|
||||
late final _sum_long_running =
|
||||
_sum_long_runningPtr.asFunction<int Function(int, int)>();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
# The Flutter tooling requires that developers have CMake 3.10 or later
|
||||
# installed. You should not increase this version, as doing so will cause
|
||||
# the plugin to fail to compile for some customers of the plugin.
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# Project-level configuration.
|
||||
set(PROJECT_NAME "{{projectName}}")
|
||||
project(${PROJECT_NAME} LANGUAGES CXX)
|
||||
|
||||
# Invoke the build for native code shared with the other target platforms.
|
||||
# This can be changed to accomodate different builds.
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")
|
||||
|
||||
# List of absolute paths to libraries that should be bundled with the plugin.
|
||||
# This list could contain prebuilt libraries, or libraries created by an
|
||||
# external build triggered from this build file.
|
||||
set({{projectName}}_bundled_libraries
|
||||
# Defined in ../src/CMakeLists.txt.
|
||||
# This can be changed to accomodate different builds.
|
||||
$<TARGET_FILE:{{projectName}}>
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
// Relative import to be able to reuse the C sources.
|
||||
// See the comment in ../{projectName}}.podspec for more information.
|
||||
#include "../../src/{{projectName}}.c"
|
||||
@@ -0,0 +1,17 @@
|
||||
# The Flutter tooling requires that developers have CMake 3.10 or later
|
||||
# installed. You should not increase this version, as doing so will cause
|
||||
# the plugin to fail to compile for some customers of the plugin.
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project({{projectName}}_library VERSION 0.0.1 LANGUAGES C)
|
||||
|
||||
add_library({{projectName}} SHARED
|
||||
"{{projectName}}.c"
|
||||
)
|
||||
|
||||
set_target_properties({{projectName}} PROPERTIES
|
||||
PUBLIC_HEADER {{projectName}}.h
|
||||
OUTPUT_NAME "{{projectName}}"
|
||||
)
|
||||
|
||||
target_compile_definitions({{projectName}} PUBLIC DART_SHARED_LIB)
|
||||
@@ -0,0 +1,23 @@
|
||||
#include "{{projectName}}.h"
|
||||
|
||||
// A very short-lived native function.
|
||||
//
|
||||
// For very short-lived functions, it is fine to call them on the main isolate.
|
||||
// They will block the Dart execution while running the native function, so
|
||||
// only do this for native functions which are guaranteed to be short-lived.
|
||||
FFI_PLUGIN_EXPORT intptr_t sum(intptr_t a, intptr_t b) { return a + b; }
|
||||
|
||||
// A longer-lived native function, which occupies the thread calling it.
|
||||
//
|
||||
// Do not call these kind of native functions in the main isolate. They will
|
||||
// block Dart execution. This will cause dropped frames in Flutter applications.
|
||||
// Instead, call these native functions on a separate isolate.
|
||||
FFI_PLUGIN_EXPORT intptr_t sum_long_running(intptr_t a, intptr_t b) {
|
||||
// Simulate work.
|
||||
#if _WIN32
|
||||
Sleep(5000);
|
||||
#else
|
||||
usleep(5000 * 1000);
|
||||
#endif
|
||||
return a + b;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if _WIN32
|
||||
#define FFI_PLUGIN_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define FFI_PLUGIN_EXPORT
|
||||
#endif
|
||||
|
||||
// A very short-lived native function.
|
||||
//
|
||||
// For very short-lived functions, it is fine to call them on the main isolate.
|
||||
// They will block the Dart execution while running the native function, so
|
||||
// only do this for native functions which are guaranteed to be short-lived.
|
||||
FFI_PLUGIN_EXPORT intptr_t sum(intptr_t a, intptr_t b);
|
||||
|
||||
// A longer lived native function, which occupies the thread calling it.
|
||||
//
|
||||
// Do not call these kind of native functions in the main isolate. They will
|
||||
// block Dart execution. This will cause dropped frames in Flutter applications.
|
||||
// Instead, call these native functions on a separate isolate.
|
||||
FFI_PLUGIN_EXPORT intptr_t sum_long_running(intptr_t a, intptr_t b);
|
||||
@@ -0,0 +1,23 @@
|
||||
# The Flutter tooling requires that developers have a version of Visual Studio
|
||||
# installed that includes CMake 3.14 or later. You should not increase this
|
||||
# version, as doing so will cause the plugin to fail to compile for some
|
||||
# customers of the plugin.
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
# Project-level configuration.
|
||||
set(PROJECT_NAME "{{projectName}}")
|
||||
project(${PROJECT_NAME} LANGUAGES CXX)
|
||||
|
||||
# Invoke the build for native code shared with the other target platforms.
|
||||
# This can be changed to accomodate different builds.
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")
|
||||
|
||||
# List of absolute paths to libraries that should be bundled with the plugin.
|
||||
# This list could contain prebuilt libraries, or libraries created by an
|
||||
# external build triggered from this build file.
|
||||
set({{projectName}}_bundled_libraries
|
||||
# Defined in ../src/CMakeLists.txt.
|
||||
# This can be changed to accomodate different builds.
|
||||
$<TARGET_FILE:{{projectName}}>
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -7,4 +7,9 @@ version:
|
||||
revision: {{flutterRevision}}
|
||||
channel: {{flutterChannel}}
|
||||
|
||||
{{#withFfiPluginHook}}
|
||||
project_type: plugin_ffi
|
||||
{{/withFfiPluginHook}}
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
project_type: plugin
|
||||
{{/withPlatformChannelPluginHook}}
|
||||
9
packages/flutter_tools/templates/plugin_shared/android.tmpl/.gitignore
vendored
Normal file
9
packages/flutter_tools/templates/plugin_shared/android.tmpl/.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.cxx
|
||||
@@ -0,0 +1 @@
|
||||
rootProject.name = '{{projectName}}'
|
||||
@@ -0,0 +1,3 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="{{androidIdentifier}}">
|
||||
</manifest>
|
||||
@@ -12,6 +12,13 @@ Pod::Spec.new do |s|
|
||||
s.homepage = 'http://example.com'
|
||||
s.license = { :file => '../LICENSE' }
|
||||
s.author = { 'Your Company' => 'email@example.com' }
|
||||
|
||||
{{#withFfiPluginHook}}
|
||||
# This will ensure the source files in Classes/ are included in the native
|
||||
# builds of apps using this FFI plugin. Podspec does not support relative
|
||||
# paths, so Classes contains a forwarder C file that relatively imports
|
||||
# `../src/*` so that the C sources can be shared among all target platforms.
|
||||
{{/withFfiPluginHook}}
|
||||
s.source = { :path => '.' }
|
||||
s.source_files = 'Classes/**/*'
|
||||
s.dependency 'FlutterMacOS'
|
||||
@@ -16,4 +16,4 @@
|
||||
<orderEntry type="library" name="Dart SDK" level="project" />
|
||||
<orderEntry type="library" name="Flutter Plugins" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
</module>
|
||||
@@ -5,7 +5,12 @@ homepage:
|
||||
|
||||
environment:
|
||||
sdk: {{dartSdkVersionBounds}}
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
flutter: ">=2.5.0"
|
||||
{{/withPlatformChannelPluginHook}}
|
||||
{{#withFfiPluginHook}}
|
||||
flutter: ">={{minFrameworkVersionFfiPlugin}}"
|
||||
{{/withFfiPluginHook}}
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -16,6 +21,9 @@ dependencies:
|
||||
{{/web}}
|
||||
|
||||
dev_dependencies:
|
||||
{{#withFfiPluginHook}}
|
||||
ffigen: ^4.1.2
|
||||
{{/withFfiPluginHook}}
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^1.0.0
|
||||
@@ -26,9 +34,52 @@ dev_dependencies:
|
||||
# The following section is specific to Flutter.
|
||||
flutter:
|
||||
# This section identifies this Flutter project as a plugin project.
|
||||
# The 'pluginClass' and Android 'package' identifiers should not ordinarily
|
||||
# be modified. They are used by the tooling to maintain consistency when
|
||||
# The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
|
||||
# which should be registered in the plugin registry. This is required for
|
||||
# using method channels.
|
||||
# The Android 'package' specifies package in which the registered class is.
|
||||
# This is required for using method channels on Android.
|
||||
# The 'ffiPlugin' specifies that native code should be built and bundled.
|
||||
# This is required for using `dart:ffi`.
|
||||
# All these are used by the tooling to maintain consistency when
|
||||
# adding or updating assets for this project.
|
||||
{{#withFfiPluginHook}}
|
||||
#
|
||||
# Please refer to README.md for a detailed explanation.
|
||||
plugin:
|
||||
platforms:
|
||||
{{#no_platforms}}
|
||||
# This FFI plugin project was generated without specifying any
|
||||
# platforms with the `--platform` argument. If you see the `some_platform` map below, remove it and
|
||||
# then add platforms following the instruction here:
|
||||
# https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms
|
||||
# -------------------
|
||||
some_platform:
|
||||
ffiPlugin: true
|
||||
# -------------------
|
||||
{{/no_platforms}}
|
||||
{{#android}}
|
||||
android:
|
||||
ffiPlugin: true
|
||||
{{/android}}
|
||||
{{#ios}}
|
||||
ios:
|
||||
ffiPlugin: true
|
||||
{{/ios}}
|
||||
{{#linux}}
|
||||
linux:
|
||||
ffiPlugin: true
|
||||
{{/linux}}
|
||||
{{#macos}}
|
||||
macos:
|
||||
ffiPlugin: true
|
||||
{{/macos}}
|
||||
{{#windows}}
|
||||
windows:
|
||||
ffiPlugin: true
|
||||
{{/windows}}
|
||||
{{/withFfiPluginHook}}
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
plugin:
|
||||
platforms:
|
||||
{{#no_platforms}}
|
||||
@@ -67,6 +118,7 @@ flutter:
|
||||
pluginClass: {{pluginDartClass}}Web
|
||||
fileName: {{projectName}}_web.dart
|
||||
{{/web}}
|
||||
{{/withPlatformChannelPluginHook}}
|
||||
|
||||
# To add assets to your plugin package, add an assets section, like this:
|
||||
# assets:
|
||||
@@ -5,7 +5,6 @@
|
||||
"templates/app/lib/main.dart.tmpl",
|
||||
"templates/app/pubspec.yaml.tmpl",
|
||||
"templates/app/README.md.tmpl",
|
||||
"templates/app/test/widget_test.dart.tmpl",
|
||||
"templates/app/winuwp.tmpl/.gitignore",
|
||||
|
||||
"templates/app_shared/.gitignore.tmpl",
|
||||
@@ -201,6 +200,8 @@
|
||||
"templates/app_shared/winuwp.tmpl/runner_uwp/resources.pri.img.tmpl",
|
||||
"templates/app_shared/winuwp.tmpl/runner_uwp/Windows_TemporaryKey.pfx.img.tmpl",
|
||||
|
||||
"templates/app_test_widget/test/widget_test.dart.tmpl",
|
||||
|
||||
"templates/cocoapods/Podfile-ios-objc",
|
||||
"templates/cocoapods/Podfile-ios-swift",
|
||||
"templates/cocoapods/Podfile-macos",
|
||||
@@ -304,13 +305,6 @@
|
||||
"templates/package/README.md.tmpl",
|
||||
"templates/package/test/projectName_test.dart.tmpl",
|
||||
|
||||
"templates/plugin/.gitignore.tmpl",
|
||||
"templates/plugin/.idea/libraries/Dart_SDK.xml.tmpl",
|
||||
"templates/plugin/.idea/modules.xml.tmpl",
|
||||
"templates/plugin/.idea/runConfigurations/example_lib_main_dart.xml.tmpl",
|
||||
"templates/plugin/.idea/workspace.xml.tmpl",
|
||||
"templates/plugin/.metadata.tmpl",
|
||||
"templates/plugin/analysis_options.yaml.tmpl",
|
||||
"templates/plugin/android-java.tmpl/build.gradle.tmpl",
|
||||
"templates/plugin/android-java.tmpl/projectName_android.iml.tmpl",
|
||||
"templates/plugin/android-java.tmpl/src/main/java/androidIdentifier/pluginClass.java.tmpl",
|
||||
@@ -322,7 +316,6 @@
|
||||
"templates/plugin/android.tmpl/gradle.properties.tmpl",
|
||||
"templates/plugin/android.tmpl/settings.gradle.tmpl",
|
||||
"templates/plugin/android.tmpl/src/main/AndroidManifest.xml.tmpl",
|
||||
"templates/plugin/CHANGELOG.md.tmpl",
|
||||
"templates/plugin/ios-objc.tmpl/Classes/pluginClass.h.tmpl",
|
||||
"templates/plugin/ios-objc.tmpl/Classes/pluginClass.m.tmpl",
|
||||
"templates/plugin/ios-objc.tmpl/projectName.podspec.tmpl",
|
||||
@@ -333,22 +326,51 @@
|
||||
"templates/plugin/ios.tmpl/.gitignore",
|
||||
"templates/plugin/ios.tmpl/Assets/.gitkeep",
|
||||
"templates/plugin/lib/projectName.dart.tmpl",
|
||||
"templates/plugin/LICENSE.tmpl",
|
||||
"templates/plugin/linux.tmpl/CMakeLists.txt.tmpl",
|
||||
"templates/plugin/linux.tmpl/include/projectName.tmpl/pluginClassSnakeCase.h.tmpl",
|
||||
"templates/plugin/linux.tmpl/pluginClassSnakeCase.cc.tmpl",
|
||||
"templates/plugin/macos.tmpl/Classes/pluginClass.swift.tmpl",
|
||||
"templates/plugin/macos.tmpl/projectName.podspec.tmpl",
|
||||
"templates/plugin/projectName.iml.tmpl",
|
||||
"templates/plugin/pubspec.yaml.tmpl",
|
||||
"templates/plugin/README.md.tmpl",
|
||||
"templates/plugin/test/projectName_test.dart.tmpl",
|
||||
"templates/plugin/windows.tmpl/.gitignore",
|
||||
"templates/plugin/windows.tmpl/CMakeLists.txt.tmpl",
|
||||
"templates/plugin/windows.tmpl/include/projectName.tmpl/pluginClassSnakeCase.h.tmpl",
|
||||
"templates/plugin/windows.tmpl/pluginClassSnakeCase.cpp.tmpl",
|
||||
"templates/plugin/lib/projectName_web.dart.tmpl",
|
||||
|
||||
"templates/plugin_ffi/android.tmpl/build.gradle.tmpl",
|
||||
"templates/plugin_ffi/android.tmpl/projectName_android.iml.tmpl",
|
||||
"templates/plugin_ffi/ffigen.yaml.tmpl",
|
||||
"templates/plugin_ffi/ios.tmpl/.gitignore",
|
||||
"templates/plugin_ffi/ios.tmpl/Classes/projectName.c.tmpl",
|
||||
"templates/plugin_ffi/ios.tmpl/projectName.podspec.tmpl",
|
||||
"templates/plugin_ffi/lib/projectName_bindings_generated.dart.tmpl",
|
||||
"templates/plugin_ffi/lib/projectName.dart.tmpl",
|
||||
"templates/plugin_ffi/linux.tmpl/CMakeLists.txt.tmpl",
|
||||
"templates/plugin_ffi/linux.tmpl/include/projectName.tmpl/plugin_ffiClassSnakeCase.h.tmpl",
|
||||
"templates/plugin_ffi/macos.tmpl/Classes/projectName.c.tmpl",
|
||||
"templates/plugin_ffi/README.md.tmpl",
|
||||
"templates/plugin_ffi/src.tmpl/CMakeLists.txt.tmpl",
|
||||
"templates/plugin_ffi/src.tmpl/projectName.c.tmpl",
|
||||
"templates/plugin_ffi/src.tmpl/projectName.h.tmpl",
|
||||
"templates/plugin_ffi/windows.tmpl/CMakeLists.txt.tmpl",
|
||||
|
||||
"templates/plugin_shared/.gitignore.tmpl",
|
||||
"templates/plugin_shared/.idea/libraries/Dart_SDK.xml.tmpl",
|
||||
"templates/plugin_shared/.idea/modules.xml.tmpl",
|
||||
"templates/plugin_shared/.idea/runConfigurations/example_lib_main_dart.xml.tmpl",
|
||||
"templates/plugin_shared/.idea/workspace.xml.tmpl",
|
||||
"templates/plugin_shared/.metadata.tmpl",
|
||||
"templates/plugin_shared/analysis_options.yaml.tmpl",
|
||||
"templates/plugin_shared/android.tmpl/.gitignore",
|
||||
"templates/plugin_shared/android.tmpl/settings.gradle.tmpl",
|
||||
"templates/plugin_shared/android.tmpl/src/main/AndroidManifest.xml.tmpl",
|
||||
"templates/plugin_shared/CHANGELOG.md.tmpl",
|
||||
"templates/plugin_shared/LICENSE.tmpl",
|
||||
"templates/plugin_shared/macos.tmpl/projectName.podspec.tmpl",
|
||||
"templates/plugin_shared/projectName.iml.tmpl",
|
||||
"templates/plugin_shared/pubspec.yaml.tmpl",
|
||||
"templates/plugin_shared/windows.tmpl/.gitignore",
|
||||
|
||||
"templates/skeleton/assets/images/2.0x/flutter_logo.png.img.tmpl",
|
||||
"templates/skeleton/assets/images/3.0x/flutter_logo.png.img.tmpl",
|
||||
"templates/skeleton/assets/images/flutter_logo.png.img.tmpl",
|
||||
|
||||
Reference in New Issue
Block a user