WT1.1.2f Property, Purchase, Product, BMR, BMI
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/property.dart';
|
||||
import 'package:aitrainer_app/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();
|
||||
}
|
||||
this._properties.forEach((element) {
|
||||
if (name == element.propertyName) {
|
||||
property = element;
|
||||
}
|
||||
});
|
||||
return property;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user