【发布时间】:2021-12-11 01:32:01
【问题描述】:
address_model.dart
class Address {
String placeFormattedAddress;
String placeName;
String placeId;
double latitude;
double longitude;
Address(this.latitude, this.longitude,
this.placeFormattedAddress,
this.placeId, this.placeName);
}
这里是 assistant_methods.dart
if (response != "failed") {
placeAddress = response["results"][0].
["formatted_address"];
Address userPickUpAdress = Address();
userPickUpAdress.longitude = position.longitude;
userPickUpAdress.latitude = position.latitude;
userPickUpAdress.placeName = placeAddress;
Provider.of<AppData>(context, listen: false)
.updatePickUpAdress(userPickUpAdress);
}
错误行在第 4 行的 assitant_methods.dart 上,此时我调用了 Address(),并且在下面的代码中我已经初始化了
【问题讨论】: