You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
528 B
Dart
19 lines
528 B
Dart
import 'dart:io';
|
|
|
|
import 'package:image_picker/image_picker.dart';
|
|
|
|
abstract class CommonServices {
|
|
Future<File?> pickImageFromPhone(int sourceFlag);
|
|
}
|
|
|
|
class CommonServicesImp implements CommonServices {
|
|
@override
|
|
Future<File?> pickImageFromPhone(int sourceFlag) async {
|
|
final picker = ImagePicker();
|
|
final pickedImage = await picker.pickImage(
|
|
source: sourceFlag == 0 ? ImageSource.camera : ImageSource.gallery,
|
|
);
|
|
final pickedImageFile = File(pickedImage!.path);
|
|
return pickedImageFile;
|
|
}
|
|
} |