dart format
This commit is contained in:
@@ -11,12 +11,20 @@ class GetTimegridUnits extends WebuntisApi {
|
||||
Future<GetTimegridUnitsResponse> run() async {
|
||||
final rawAnswer = await query(this);
|
||||
try {
|
||||
return finalize(GetTimegridUnitsResponse.fromJson(jsonDecode(rawAnswer) as Map<String, dynamic>));
|
||||
return finalize(
|
||||
GetTimegridUnitsResponse.fromJson(
|
||||
jsonDecode(rawAnswer) as Map<String, dynamic>,
|
||||
),
|
||||
);
|
||||
} catch (e, trace) {
|
||||
log(trace.toString());
|
||||
log('Failed to parse getTimegridUnits data with server response: $rawAnswer');
|
||||
log(
|
||||
'Failed to parse getTimegridUnits data with server response: $rawAnswer',
|
||||
);
|
||||
}
|
||||
|
||||
throw Exception('Failed to parse getTimegridUnits server response: $rawAnswer');
|
||||
throw Exception(
|
||||
'Failed to parse getTimegridUnits server response: $rawAnswer',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import 'get_timegrid_units_response.dart';
|
||||
|
||||
class GetTimegridUnitsCache extends SimpleCache<GetTimegridUnitsResponse> {
|
||||
GetTimegridUnitsCache({super.onUpdate, super.renew})
|
||||
: super(
|
||||
cacheTime: RequestCache.cacheDay,
|
||||
loader: () => GetTimegridUnits().run(),
|
||||
fromJson: GetTimegridUnitsResponse.fromJson,
|
||||
) {
|
||||
: super(
|
||||
cacheTime: RequestCache.cacheDay,
|
||||
loader: () => GetTimegridUnits().run(),
|
||||
fromJson: GetTimegridUnitsResponse.fromJson,
|
||||
) {
|
||||
start('wu-timegrid');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ class GetTimegridUnitsResponse extends ApiResponse {
|
||||
|
||||
GetTimegridUnitsResponse(this.result);
|
||||
|
||||
factory GetTimegridUnitsResponse.fromJson(Map<String, dynamic> json) => _$GetTimegridUnitsResponseFromJson(json);
|
||||
factory GetTimegridUnitsResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$GetTimegridUnitsResponseFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$GetTimegridUnitsResponseToJson(this);
|
||||
}
|
||||
|
||||
@@ -21,7 +22,8 @@ class GetTimegridUnitsResponseDay {
|
||||
|
||||
GetTimegridUnitsResponseDay(this.day, this.timeUnits);
|
||||
|
||||
factory GetTimegridUnitsResponseDay.fromJson(Map<String, dynamic> json) => _$GetTimegridUnitsResponseDayFromJson(json);
|
||||
factory GetTimegridUnitsResponseDay.fromJson(Map<String, dynamic> json) =>
|
||||
_$GetTimegridUnitsResponseDayFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$GetTimegridUnitsResponseDayToJson(this);
|
||||
}
|
||||
|
||||
@@ -33,6 +35,7 @@ class GetTimegridUnitsResponseUnit {
|
||||
|
||||
GetTimegridUnitsResponseUnit(this.name, this.startTime, this.endTime);
|
||||
|
||||
factory GetTimegridUnitsResponseUnit.fromJson(Map<String, dynamic> json) => _$GetTimegridUnitsResponseUnitFromJson(json);
|
||||
factory GetTimegridUnitsResponseUnit.fromJson(Map<String, dynamic> json) =>
|
||||
_$GetTimegridUnitsResponseUnitFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$GetTimegridUnitsResponseUnitToJson(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user