import 'dart:convert'; import 'package:aitrainer_app/model/cache.dart'; import 'package:aitrainer_app/service/api.dart'; import '../model/property.dart'; class PropertyApi { final APIClient _client = APIClient(); Future> getProperties() async { final body = await _client.get("property/", ""); final Iterable json = jsonDecode(body); final List properties = json.map((property) => Property.fromJson(property)).toList(); Cache().setProperties(properties); return properties; } }