Issue
Flutter's CameraController
has a takePicture()
method for taking picture from the camera which gives type of Future<XFile>
, so I need to convert it to Image
type from package:image/image.dart
package to manually crop it with another method.
How to convert it?
Solution
This is my found solution:
import 'dart:io';
import 'package:image/image.dart' as img;
...
CameraController _controller;
...
final xFile = await _controller.takePicture();
final path = xFile.path;
final bytes = await File(path).readAsBytes();
final img.Image image = img.decodeImage(bytes);
Answered By - Mohsen Emami Answer Checked By - Mary Flores (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.