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 getPlatformVersion() async { final version = await methodChannel.invokeMethod('getPlatformVersion'); return version; } @override Future openDevice(String devicePath, int baudRate) async { final result = await methodChannel.invokeMethod( 'openDevice', {'devicePath': devicePath, 'baudRate': baudRate}, ); return result ?? false; } @override Future closeDevice() async { await methodChannel.invokeMethod('closeDevice'); } @override Future> enrollFingerprint(int userId) async { final result = await methodChannel.invokeMethod('enrollFingerprint', {'userId': userId}); return Map.from(result as Map); } @override Future> verifyFingerprint(int userId) async { final result = await methodChannel.invokeMethod('verifyFingerprint', {'userId': userId}); return Map.from(result as Map); } @override Future> deleteAllFingerprint() async { final result = await methodChannel.invokeMethod('deleteAllFingerprint'); return Map.from(result as Map); } @override Future> deleteOneFingerprint(int userId) async { final result = await methodChannel.invokeMethod('deleteOneFingerprint', {'userId': userId}); return Map.from(result as Map); } @override Future> identifyFingerprint() async { final result = await methodChannel.invokeMethod('identifyFingerprint'); return Map.from(result as Map); } @override Future> getUserCount() async { final result = await methodChannel.invokeMethod('getUserCount'); return Map.from(result as Map); } }