factory FieldModel.fromJson(String fieldId, Map<dynamic, dynamic> json) =>
FieldModel(
fieldId: fieldId,
ownerId: json['ownerId'],
name: json['name'],
imageUrl: json['imageUrl'],
///how to extract this, its a LatLng class from "google_maps_flutter_platform_interface/src/types/location.dart"
latLng: json['latLng'],
description: json['description'],
charges: json['charges'],
timeSlots: json['timeSlots'],
availability: json['availability'],
);
錯誤:“型別 '_InternalLinkedHashMap<String, dynamic>' 不是 LatLng 的子型別。”
uj5u.com熱心網友回復:
假設您的 json 看起來像這樣,
...
"latLng": {"lat": 1234.121, "lng": 958.1232}
...
您將不得不使用您的 latLng 值來創建一個 LatLng 物件,
latLng: LatLng(json['latLng']['lat'], json['latLng']['lng']),
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/463817.html
上一篇:Ansibleset_factsbylocalhostjson檔案并復制到遠程主機
下一篇:pythonJSONfor回圈
