This commit is contained in:
2026-03-31 08:51:33 +08:00
commit e9f4844352
63 changed files with 8950 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'zhiwen_platform_interface.dart';
/// An implementation of [ZhiwenPlatform] that uses method channels.
class MethodChannelZhiwen extends ZhiwenPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('zhiwen');
@override
Future<String?> getPlatformVersion() async {
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
return version;
}
@override
Future<bool> openDevice(String devicePath, int baudRate) async {
final result = await methodChannel.invokeMethod<bool>(
'openDevice',
{'devicePath': devicePath, 'baudRate': baudRate},
);
return result ?? false;
}
@override
Future<void> closeDevice() async {
await methodChannel.invokeMethod('closeDevice');
}
@override
Future<Map<String, dynamic>> enrollFingerprint(int userId) async {
final result = await methodChannel.invokeMethod('enrollFingerprint', {'userId': userId});
return Map<String, dynamic>.from(result as Map);
}
@override
Future<Map<String, dynamic>> verifyFingerprint(int userId) async {
final result = await methodChannel.invokeMethod('verifyFingerprint', {'userId': userId});
return Map<String, dynamic>.from(result as Map);
}
@override
Future<Map<String, dynamic>> deleteAllFingerprint() async {
final result = await methodChannel.invokeMethod('deleteAllFingerprint');
return Map<String, dynamic>.from(result as Map);
}
@override
Future<Map<String, dynamic>> deleteOneFingerprint(int userId) async {
final result = await methodChannel.invokeMethod('deleteOneFingerprint', {'userId': userId});
return Map<String, dynamic>.from(result as Map);
}
@override
Future<Map<String, dynamic>> identifyFingerprint() async {
final result = await methodChannel.invokeMethod('identifyFingerprint');
return Map<String, dynamic>.from(result as Map);
}
@override
Future<Map<String, dynamic>> getUserCount() async {
final result = await methodChannel.invokeMethod('getUserCount');
return Map<String, dynamic>.from(result as Map);
}
}