29 lines
724 B
Dart
29 lines
724 B
Dart
import 'package:making_school_asignment_app/common/job/enum_subject.dart';
|
|
import 'package:making_school_asignment_app/common/store/user_store.dart';
|
|
|
|
class EnumUtils {
|
|
static String formatSubject(int id) {
|
|
if (UserStore.to.subjectList.isEmpty) {
|
|
return '';
|
|
}
|
|
try {
|
|
EnumSubject item = UserStore.to.subjectList.firstWhere((element) => element.id == id);
|
|
return item.name;
|
|
} catch (e) {
|
|
return '';
|
|
}
|
|
}
|
|
|
|
static String formatGrade(int id) {
|
|
if (UserStore.to.gradeList.isEmpty) {
|
|
return '';
|
|
}
|
|
try {
|
|
EnumSubject item = UserStore.to.gradeList.firstWhere((element) => element.id == id);
|
|
return item.name;
|
|
} catch (e) {
|
|
return '';
|
|
}
|
|
}
|
|
}
|