apiLoad method
dynamic
apiLoad(
- BuildContext context,
- dynamic updateUI(),
- int? testRecordId,
- dynamic snackHere(
- dynamic
apiLoad loads a record from the https://flutster.com API.
Implementation
apiLoad(
BuildContext context,
Function() updateUI,
int? testRecordId,
Function(dynamic) snackHere,
) async {
if (testRecordId == null) {
snack("Test record id is null, cannot load.", context);
return;
}
apiLoadOngoing = true;
updateUI();
testNameFieldController.text = "";
widget.flutsterTestRecord.clear();
String? res;
try {
res = await widget.flutsterTestRecord.fromApi(
testRecordId,
flutsterTestRecorderState: this,
);
} catch (e, st) {
res = "Failed to load test record from API";
debugPrint("$e $st");
}
apiLoadOngoing = false;
snackHere(
res,
);
updateUI();
}