Closed brianblanchard-wf closed 2 years ago
This does not fix it for me compiling on linux for either android or linux itself:
ERROR: .dart_tool/flutter_build/generated_main.dart:61:9: Error: Undefined name 'Win32BiometricStoragePlugin'.
ERROR: Win32BiometricStoragePlugin.registerWith();
ERROR: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
I think this is because pubspec.yaml
still references Win32BiometricStoragePlugin
. If I remove the reference, the error does not occur.
@miDeb my bad, I forgot to export the Win32BiometricStoragePlugin
. Can you try again with the latest commit?
@hpoul as yes, my bad I thought I did that.
@brianblanchard-wf I can confirm that it works for me now.
@hpoul regarding federated plugins, it might be worth a discussion in breaking out the different platform implementations into different packages similar to how some of the official flutter plugins (like shared_preferences
) do it. So you would have something like biometric_storage
, biometric_storage_platform_interface
, biometric_storage_windows
, etc that can all live in this repo as sub packages.
Let me know if that is something that is interesting to you and I can take a stab at it in my free time.
For sure out of scope for this PR, I was just looking to unblock consumers on the latest stable version of Flutter 😄
@hpoul I did a quick test and it seems if I just change the windows
plugin entry in the pubspec.yaml
to this:
windows:
pluginClass: none
then no other code changes are required. Do you want to go the route of the current implementation with dartPluginClass
or just update the pubspec.yaml
to the above?
@brianblanchard-wf are you saying that the fileName
property is working? 🤔️ To me this would look nicer, but since it's not documented, it might be better to go the route of exporting the class from the main library file 😅️ thanks, I'll merge it this way and see if it works for everyone 🤞
Description
stable
channel, there are some changes with how dart only plugin implementations get registered.generated_main.dart
file under the.dart-tool/flutter_build
directory which for the example app for this plugin looks like thisimport 'package:biometric_storage_example/main.dart' as entrypoint; import 'dart:io'; // flutter_ignore: dart_io_import. import 'package:biometric_storage/biometric_storage.dart';
@pragma('vm:entry-point') class _PluginRegistrant {
@pragma('vm:entry-point') static void register() { if (Platform.isAndroid) { } else if (Platform.isIOS) { } else if (Platform.isLinux) { } else if (Platform.isMacOS) { } else if (Platform.isWindows) { try { Win32BiometricStoragePlugin.register(); } catch (err) { print( '
biometric_storage
threw an error: $err. ' 'The app may not function as expected until you remove this plugin from pubspec.yaml' ); rethrow; }}
}
typedef _UnaryFunction = dynamic Function(List args);
typedef _NullaryFunction = dynamic Function();
void main(List args) {
if (entrypoint.main is _UnaryFunction) {
(entrypoint.main as _UnaryFunction)(args);
} else {
(entrypoint.main as _NullaryFunction)();
}
}
Error: Undefined name 'Win32BiometricStoragePlugin'. .dart_tool/flutter_build/generated_main.dart:38 Win32BiometricStoragePlugin.registerWith();