updated project linter-rules and enforced them

This commit is contained in:
2024-03-29 18:22:55 +01:00
parent 21e11b6c2a
commit 75846750f7
113 changed files with 553 additions and 554 deletions

View File

@ -6,7 +6,7 @@ import '../../mhslApi.dart';
import 'getBreakersResponse.dart';
class GetBreakers extends MhslApi<GetBreakersResponse> {
GetBreakers() : super("breaker/");
GetBreakers() : super('breaker/');
@override
GetBreakersResponse assemble(String raw) {

View File

@ -6,7 +6,7 @@ import 'getBreakersResponse.dart';
class GetBreakersCache extends RequestCache<GetBreakersResponse> {
GetBreakersCache({onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
start("MarianumMobile", "breakers");
start('MarianumMobile', 'breakers');
}
@override

View File

@ -28,9 +28,9 @@ class GetBreakersReponseObject {
}
enum BreakerArea {
@JsonValue("GLOBAL") global,
@JsonValue("TIMETABLE") timetable,
@JsonValue("TALK") talk,
@JsonValue("FILES") files,
@JsonValue("MORE") more,
@JsonValue('GLOBAL') global,
@JsonValue('TIMETABLE') timetable,
@JsonValue('TALK') talk,
@JsonValue('FILES') files,
@JsonValue('MORE') more,
}

View File

@ -9,11 +9,11 @@ import 'getCustomTimetableEventResponse.dart';
class GetCustomTimetableEvent extends MhslApi<GetCustomTimetableEventResponse> {
GetCustomTimetableEventParams params;
GetCustomTimetableEvent(this.params) : super("server/timetable/customEvents?user=${params.user}");
GetCustomTimetableEvent(this.params) : super('server/timetable/customEvents?user=${params.user}');
@override
GetCustomTimetableEventResponse assemble(String raw) {
return GetCustomTimetableEventResponse.fromJson({"events": jsonDecode(raw)});
return GetCustomTimetableEventResponse.fromJson({'events': jsonDecode(raw)});
}
@override

View File

@ -9,7 +9,7 @@ class GetCustomTimetableEventCache extends RequestCache<GetCustomTimetableEventR
GetCustomTimetableEventParams params;
GetCustomTimetableEventCache(this.params, {onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
start("MarianumMobile", "customTimetableEvents");
start('MarianumMobile', 'customTimetableEvents');
}
@override

View File

@ -6,7 +6,7 @@ import '../../mhslApi.dart';
import 'getMessagesResponse.dart';
class GetMessages extends MhslApi<GetMessagesResponse> {
GetMessages() : super("message/messages.json");
GetMessages() : super('message/messages.json');
@override

View File

@ -6,7 +6,7 @@ import 'getMessagesResponse.dart';
class GetMessagesCache extends RequestCache<GetMessagesResponse> {
GetMessagesCache({onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
start("MarianumMobile", "message");
start('MarianumMobile', 'message');
}
@override

View File

@ -15,21 +15,21 @@ abstract class MhslApi<T> extends ApiRequest {
T assemble(String raw);
Future<T> run() async {
Uri endpoint = Uri.parse("https://mhsl.eu/marianum/marianummobile/$subpath");
Uri endpoint = Uri.parse('https://mhsl.eu/marianum/marianummobile/$subpath');
http.Response? data = await request(endpoint);
if(data == null) {
throw ApiError("Request could not be dispatched!");
throw ApiError('Request could not be dispatched!');
}
if(data.statusCode > 299) {
throw ApiError("Non 200 Status code from mhsl services: $subpath: ${data.statusCode}");
throw ApiError('Non 200 Status code from mhsl services: $subpath: ${data.statusCode}');
}
return assemble(utf8.decode(data.bodyBytes));
}
static String dateTimeToJson(DateTime time) => Jiffy.parseFromDateTime(time).format(pattern: "yyyy-MM-dd HH:mm:ss");
static String dateTimeToJson(DateTime time) => Jiffy.parseFromDateTime(time).format(pattern: 'yyyy-MM-dd HH:mm:ss');
static DateTime dateTimeFromJson(String time) => DateTime.parse(time);
}

View File

@ -9,7 +9,7 @@ import 'notifyRegisterParams.dart';
class NotifyRegister extends MhslApi<void> {
NotifyRegisterParams params;
NotifyRegister(this.params) : super("notify/register/");
NotifyRegister(this.params) : super('notify/register/');
@override

View File

@ -12,7 +12,7 @@ import 'updateUserIndexParams.dart';
class UpdateUserIndex extends MhslApi<void> {
UpdateUserIndexParams params;
UpdateUserIndex(this.params) : super("server/userIndex/update");
UpdateUserIndex(this.params) : super('server/userIndex/update');
@override
void assemble(String raw) {}
@ -20,7 +20,7 @@ class UpdateUserIndex extends MhslApi<void> {
@override
Future<http.Response> request(Uri uri) {
String data = jsonEncode(params.toJson());
log("Updating userindex:\n $data");
log('Updating userindex:\n $data');
return http.post(uri, body: data);
}