readAll method
Future<(UResponse<UAppSettings> ?, UEmptyResponse?, String?)>
readAll({
- required dynamic onOk(),
- required dynamic onError(),
- required dynamic onException(
- String e
Implementation
Future<(UResponse<UAppSettings>?, UEmptyResponse?, String?)> readAll({
required Function(UResponse<UAppSettings> r) onOk,
required Function(UEmptyResponse e) onError,
required Function(String e) onException,
}) async {
(UResponse<UAppSettings>?, UEmptyResponse?, String?) result = (null, null, null);
await UHttpClient.send(
method: "POST",
endpoint: "${U.baseUrl}/AppSettings/ReadAll",
body: <String, dynamic>{"apiKey": U.apiKey, "token": ULocalStorage.getToken()},
onSuccess: (Response r) {
final UResponse<UAppSettings> ok = UResponse<UAppSettings>.fromJson(r.body, (dynamic i) => UAppSettings.fromMap(i));
result = (ok, null, null);
onOk(ok);
},
onError: (Response r) {
final UEmptyResponse err = UEmptyResponse.fromJson(r.body);
result = (null, err, null);
onError(err);
},
onException: (String e) {
result = (null, null, e);
onException(e);
},
);
return result;
}