fix
This commit is contained in:
parent
700b620c76
commit
91beacceb6
2 changed files with 6 additions and 4 deletions
|
@ -71,9 +71,10 @@ class API {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<dynamic>> getLocations() async {
|
Future<Map<String, Location>> getLocations() async {
|
||||||
var resp = jsonDecode(await getRequest("$instance/locations"));
|
var resp = jsonDecode(await getRequest("$instance/locations"))
|
||||||
return resp as List<dynamic>;
|
as Map<String, dynamic>;
|
||||||
|
return resp.map((key, value) => MapEntry(key, Location(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Item> getItem(String item) async {
|
Future<Item> getItem(String item) async {
|
||||||
|
|
|
@ -194,9 +194,10 @@ class _SupplyPageState extends State<SupplyPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, List<dynamic>>> _fetchData() async {
|
Future<Map<String, List<dynamic>>> _fetchData() async {
|
||||||
var locations = await API().getLocations();
|
var locations_map = await API().getLocations();
|
||||||
var origins = await API().getUniqueField(widget.item.id, variant, "origin");
|
var origins = await API().getUniqueField(widget.item.id, variant, "origin");
|
||||||
origins.insert(0, "");
|
origins.insert(0, "");
|
||||||
|
var locations = locations_map.keys.toList();
|
||||||
locations.insert(0, "");
|
locations.insert(0, "");
|
||||||
return {'locations': locations, 'origins': origins};
|
return {'locations': locations, 'origins': origins};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue