start method
Implementation
@override
Future<bool> start({bool refresh = false, String? key}) async
{
bool ok = true;
try
{
file_picker.FilePicker filepicker = file_picker.FilePicker(allow);
// fire on start
if (onstart != null)
{
var handler = EventHandler(this);
ok = await handler.execute(_onstart);
if (ok == false) return ok;
}
File? file = await filepicker.launchPicker(detectors);
if (file != null)
{
if ((this.file != null) && (scope != null) && (scope!.files.containsValue(this.file))) scope!.files.remove(this.file);
this.file = file;
await onFile(file);
}
// fire on dismissed
else if (ondismissed != null)
{
var handler = EventHandler(this);
ok = await handler.execute(_ondismissed);
if (ok == false) return ok;
}
}
catch(e)
{
ok = await onFail(Data(), code: 500, message: e.toString());
}
return ok;
}