uploadFrom method
Call this if method of uploading (like, from camera) is already known.
source
can be SourceType.photoGallery, SourceType.photoCamera,
SourceType.videoGallery, SourceType.videoCamera, SourceType.file
may return null if source
is invalid.
Implementation
Future<String?> uploadFrom({
required BuildContext context,
required ImageSource? source,
Function(double)? progress,
Function? complete,
int compressQuality = 80,
String? saveAs,
String? type,
double maxHeight = 1024,
double maxWidth = 1024,
}) async {
if (source == null) return null;
String? path = await getFilePathFromPicker(
context: context,
source: source,
maxHeight: maxHeight,
maxWidth: maxWidth,
);
if (path == null) return null;
return await uploadFile(
path: path,
saveAs: saveAs,
progress: progress,
complete: complete,
compressQuality: compressQuality,
type: type,
);
}