startImageStream method
Future<void>
startImageStream(
- void onAvailable(
- CameraImageData? image
- void onError(
- dynamic
override
Implementation
@override
Future<void> startImageStream(
void Function(CameraImageData? image) onAvailable,
{void Function(dynamic)? onError}) async {
events = eventChannel.receiveBroadcastStream().listen(
(data) {
if (data is Map) {
onAvailable(
CameraImageData(
width: data['width'],
height: data['height'],
bytesPerRow: data['bytesPerRow'],
bytes: Uint8List.fromList(data['data']),
),
);
} else if (onError != null) {
onError(
CameraMacOSException(
code: "INVALID_FORMAT",
message: "Stream data is not in a valid format",
details: data,
),
);
}
},
onError: onError,
);
}