updated project linter-rules and enforced them
This commit is contained in:
analysis_options.yamloverhang.dart
lib
api
apiError.dart
app.dartmain.dartholidays
marianumcloud
autocomplete
files-sharing
talk
chat
createRoom
deleteMessage
deleteReactMessage
getParticipants
getReactions
leaveRoom
reactMessage
room
sendMessage
setFavorite
setReadMarker
talkApi.darttalkError.dartwebdav
mhsl
requestCache.dartwebuntis
model
notification
storage
theming
view
login
pages
files
more
feedback
gradeAverages
holidays
message
roomplan
share
talk
timetable
settings
widget
@ -34,21 +34,21 @@ abstract class TalkApi<T extends ApiResponse?> extends ApiRequest {
|
||||
getParameters?.update(key, (value) => value.toString());
|
||||
});
|
||||
|
||||
Uri endpoint = Uri.https("${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().domain}", "${EndpointData().nextcloud().path}/ocs/v2.php/apps/spreed/api/$path", getParameters);
|
||||
Uri endpoint = Uri.https('${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().domain}', '${EndpointData().nextcloud().path}/ocs/v2.php/apps/spreed/api/$path', getParameters);
|
||||
|
||||
headers ??= {};
|
||||
headers?.putIfAbsent("Accept", () => "application/json");
|
||||
headers?.putIfAbsent("OCS-APIRequest", () => "true");
|
||||
headers?.putIfAbsent('Accept', () => 'application/json');
|
||||
headers?.putIfAbsent('OCS-APIRequest', () => 'true');
|
||||
|
||||
http.Response? data;
|
||||
|
||||
try {
|
||||
data = await request(endpoint, body, headers);
|
||||
if(data == null) throw Exception("No response Data");
|
||||
if(data == null) throw Exception('No response Data');
|
||||
if(data.statusCode >= 400 || data.statusCode < 200) throw Exception("Response status code '${data.statusCode}' might indicate an error");
|
||||
} catch(e) {
|
||||
log(e.toString());
|
||||
throw ApiError("Request $endpoint could not be dispatched: ${e.toString()}");
|
||||
throw ApiError('Request $endpoint could not be dispatched: ${e.toString()}');
|
||||
}
|
||||
//dynamic jsonData = jsonDecode(data.body);
|
||||
|
||||
@ -59,10 +59,10 @@ abstract class TalkApi<T extends ApiResponse?> extends ApiRequest {
|
||||
return assembled;
|
||||
} catch (e) {
|
||||
// TODO report error
|
||||
log("Error assembling Talk API ${T.toString()} message: ${e.toString()} response on ${endpoint.path} with request body: $body and request headers: ${headers.toString()}");
|
||||
log('Error assembling Talk API ${T.toString()} message: ${e.toString()} response on ${endpoint.path} with request body: $body and request headers: ${headers.toString()}');
|
||||
}
|
||||
|
||||
throw Exception("Error assembling Talk API response");
|
||||
throw Exception('Error assembling Talk API response');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user