I would like to create a mock CameraImage
object to be used during integration tests in Flutter. The way I will use it is by returning a mock instance of CameraImage during cameraController.startImageStream((CameraImage image) {...})
.
The full CameraImage
file can be found here
CameraImage
definition:
class CameraImage {
CameraImage._fromPlatformData(Map<dynamic, dynamic> data)
: format = ImageFormat._fromPlatformData(data['format']),
height = data['height'],
width = data['width'],
planes = List<Plane>.unmodifiable(data['planes']
.map((dynamic planeData) => Plane._fromPlatformData(planeData)));
final ImageFormat format;
final int height;
final int width;
final List<Plane> planes;
}
If I try to instantiate it as CameraImage()
, I get
The class 'CameraImage' doesn't have a default constructor. Try using one of the named constructors defined in 'CameraImage'
If I try to serialize it using jsonEncode()
it throws an error.
What can I do?
Aucun commentaire:
Enregistrer un commentaire