32 lines
801 B
Dart
32 lines
801 B
Dart
import 'package:workouttest_util/model/cache.dart';
|
|
import 'package:workouttest_util/model/property.dart';
|
|
import 'package:workouttest_util/service/property_service.dart';
|
|
|
|
class PropertyRepository {
|
|
List<Property>? _properties;
|
|
|
|
Future<List<Property>?> getDBProperties() async {
|
|
this._properties = await PropertyApi().getProperties();
|
|
return this._properties;
|
|
}
|
|
|
|
List<Property>? getProperties() {
|
|
return this._properties;
|
|
}
|
|
|
|
Property? getPropertyByName(String name) {
|
|
Property? property;
|
|
if (_properties == null) {
|
|
_properties = Cache().getProperties();
|
|
}
|
|
if (_properties != null) {
|
|
this._properties!.forEach((element) {
|
|
if (name == element.propertyName) {
|
|
property = element;
|
|
}
|
|
});
|
|
}
|
|
return property;
|
|
}
|
|
}
|