init
This commit is contained in:
67
lib/zhiwen_method_channel.dart
Normal file
67
lib/zhiwen_method_channel.dart
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user