setFilter method
The set filter
Android 滤镜类型包含:15 边缘检测(性能模式)、43 边缘检测 Sobel 高质量(RootEncoder 2.7.0+)等,详见原生 CameraNativeView。
Throws a CameraException if the capture fails.
Implementation
Future<void> setFilter(int type, {String? filePath}) async {
if (!value.isInitialized! || _isDisposed) {
throw CameraException(
'Uninitialized CameraController.',
'setFilter was called on uninitialized CameraController',
);
}
if (!Platform.isAndroid) {
throw CameraException(
'Unsupported platforms.',
'setFilter supported android.',
);
}
try {
await _channel.invokeMethod<void>(
'setFilter',
<String, dynamic>{'type': type, 'filePath': filePath},
);
} on PlatformException catch (e) {
throw CameraException(e.code, e.message);
}
}