WT1.1.2f Property, Purchase, Product, BMR, BMI
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/property.dart';
|
||||
import 'package:aitrainer_app/service/api.dart';
|
||||
|
||||
class PropertyApi {
|
||||
final APIClient _client = new APIClient();
|
||||
|
||||
Future<List<Property>> getProperties() async {
|
||||
final body = await _client.get("property/", "");
|
||||
final Iterable json = jsonDecode(body);
|
||||
final List<Property> properties = json.map((property) => Property.fromJson(property)).toList();
|
||||
Cache().setProperties(properties);
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user