import method
Implementation
void import(void Function(UTerminalImportResponse r) onResult) => UFile.pickFiles(
allowMultiple: false,
allowedExtensions: const <String>["xlsx"],
action: (List<UFileData> files) async {
if (files.length != 1 || files.first.bytes == null || !(files.first.extension ?? "").toLowerCase().contains("xlsx")) return;
ULoading.show();
final (UResponse<UTerminalImportResponse>? ok, UEmptyResponse? error, String? exception) = await UServices.terminal.import(
p: UTerminalImportParams(file: files.first.bytes!.toBase64()),
);
ULoading.dismiss();
if (ok == null) return UToast.error(message: error?.message ?? exception ?? U.s.errorReadingData);
unawaited(read());
if (ok.result != null) onResult(ok.result!);
},
);