28 lines
673 B
Dart
28 lines
673 B
Dart
import 'dart:convert';
|
|
|
|
import '../../../requestCache.dart';
|
|
import 'getSubjects.dart';
|
|
import 'getSubjectsResponse.dart';
|
|
|
|
class GetSubjectsCache extends RequestCache<GetSubjectsResponse> {
|
|
GetSubjectsCache({
|
|
void Function(GetSubjectsResponse)? onUpdate,
|
|
void Function(Exception)? onError,
|
|
bool? renew,
|
|
}) : super(
|
|
RequestCache.cacheHour,
|
|
onUpdate,
|
|
onError: onError ?? RequestCache.ignore,
|
|
renew: renew,
|
|
) {
|
|
start('wu-subjects');
|
|
}
|
|
|
|
@override
|
|
Future<GetSubjectsResponse> onLoad() => GetSubjects().run();
|
|
|
|
@override
|
|
onLocalData(String json) => GetSubjectsResponse.fromJson(jsonDecode(json));
|
|
|
|
}
|