diff --git a/packages/flutter_tools/templates/package_ffi/ffigen.yaml.tmpl b/packages/flutter_tools/templates/package_ffi/ffigen.yaml.tmpl index 1686f0a9a43..85ce3a3e3ee 100644 --- a/packages/flutter_tools/templates/package_ffi/ffigen.yaml.tmpl +++ b/packages/flutter_tools/templates/package_ffi/ffigen.yaml.tmpl @@ -11,10 +11,6 @@ headers: include-directives: - 'src/{{projectName}}.h' ffi-native: -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 diff --git a/packages/flutter_tools/templates/package_ffi/lib/projectName_bindings_generated.dart.tmpl b/packages/flutter_tools/templates/package_ffi/lib/projectName_bindings_generated.dart.tmpl index 65642b43818..7ca6c4e57f4 100644 --- a/packages/flutter_tools/templates/package_ffi/lib/projectName_bindings_generated.dart.tmpl +++ b/packages/flutter_tools/templates/package_ffi/lib/projectName_bindings_generated.dart.tmpl @@ -1,10 +1,7 @@ -// 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`. +// ignore_for_file: type=lint, unused_import import 'dart:ffi' as ffi; /// A very short-lived native function. @@ -13,10 +10,7 @@ import 'dart:ffi' as ffi; /// 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.Native() -external int sum( - int a, - int b, -); +external int sum(int a, int b); /// A longer lived native function, which occupies the thread calling it. /// @@ -24,7 +18,4 @@ external int sum( /// block Dart execution. This will cause dropped frames in Flutter applications. /// Instead, call these native functions on a separate isolate. @ffi.Native() -external int sum_long_running( - int a, - int b, -); +external int sum_long_running(int a, int b); diff --git a/packages/flutter_tools/templates/package_ffi/pubspec.yaml.tmpl b/packages/flutter_tools/templates/package_ffi/pubspec.yaml.tmpl index 08ff9f60e88..f9bb68dff1a 100644 --- a/packages/flutter_tools/templates/package_ffi/pubspec.yaml.tmpl +++ b/packages/flutter_tools/templates/package_ffi/pubspec.yaml.tmpl @@ -9,10 +9,10 @@ dependencies: code_assets: ^1.0.0 hooks: ^1.0.0 logging: ^1.3.0 - native_toolchain_c: ^0.17.3 + native_toolchain_c: ^0.17.4 dev_dependencies: - ffi: ^2.1.3 - ffigen: ^13.0.0 + ffi: ^2.1.4 + ffigen: ^20.1.1 flutter_lints: ^6.0.0 - test: ^1.25.8 + test: ^1.28.0 diff --git a/packages/flutter_tools/templates/plugin_ffi/ffigen.yaml.tmpl b/packages/flutter_tools/templates/plugin_ffi/ffigen.yaml.tmpl index 5762da10e4a..bac5c4b9f30 100644 --- a/packages/flutter_tools/templates/plugin_ffi/ffigen.yaml.tmpl +++ b/packages/flutter_tools/templates/plugin_ffi/ffigen.yaml.tmpl @@ -10,10 +10,6 @@ headers: - '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 diff --git a/packages/flutter_tools/templates/plugin_ffi/lib/projectName_bindings_generated.dart.tmpl b/packages/flutter_tools/templates/plugin_ffi/lib/projectName_bindings_generated.dart.tmpl index 6b8022eedb7..c767984345b 100644 --- a/packages/flutter_tools/templates/plugin_ffi/lib/projectName_bindings_generated.dart.tmpl +++ b/packages/flutter_tools/templates/plugin_ffi/lib/projectName_bindings_generated.dart.tmpl @@ -1,11 +1,7 @@ -// 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`. -// ignore_for_file: type=lint +// ignore_for_file: type=lint, unused_import import 'dart:ffi' as ffi; /// Bindings for `src/{{projectName}}.h`. @@ -15,31 +11,24 @@ import 'dart:ffi' as ffi; class {{pluginDartClass}}Bindings { /// Holds the symbol lookup function. final ffi.Pointer Function(String symbolName) - _lookup; + _lookup; /// The symbols are looked up in [dynamicLibrary]. {{pluginDartClass}}Bindings(ffi.DynamicLibrary dynamicLibrary) - : _lookup = dynamicLibrary.lookup; + : _lookup = dynamicLibrary.lookup; /// The symbols are looked up with [lookup]. {{pluginDartClass}}Bindings.fromLookup( - ffi.Pointer Function(String symbolName) - lookup) - : _lookup = lookup; + ffi.Pointer Function(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, - ); + int sum(int a, int b) { + return _sum(a, b); } late final _sumPtr = @@ -51,19 +40,14 @@ class {{pluginDartClass}}Bindings { /// 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. - int sum_long_running( - int a, - int b, - ) { - return _sum_long_running( - a, - b, - ); + int sum_long_running(int a, int b) { + return _sum_long_running(a, b); } late final _sum_long_runningPtr = _lookup>( - 'sum_long_running'); - late final _sum_long_running = - _sum_long_runningPtr.asFunction(); + 'sum_long_running', + ); + late final _sum_long_running = _sum_long_runningPtr + .asFunction(); } diff --git a/packages/flutter_tools/templates/plugin_shared/pubspec.yaml.tmpl b/packages/flutter_tools/templates/plugin_shared/pubspec.yaml.tmpl index 482b52b3c35..cf883a9d068 100644 --- a/packages/flutter_tools/templates/plugin_shared/pubspec.yaml.tmpl +++ b/packages/flutter_tools/templates/plugin_shared/pubspec.yaml.tmpl @@ -20,7 +20,7 @@ dependencies: dev_dependencies: {{#withFfi}} ffi: ^2.1.3 - ffigen: ^13.0.0 + ffigen: ^20.1.1 {{/withFfi}} flutter_test: sdk: flutter