如何解决颤振项目中的这个错误?
Future<void> getLocationFromPlace(int index) async {
if (autocompletePlaces.isNotEmpty) {
locationController.text = autocompletePlaces[index].description!;
searchAddressController.clear();
final prediction =
await _service.getPlaceDetail(autocompletePlaces[index], uuid);
uuid = const Uuid().v4();
updatePosition(
LatLng(double.parse(prediction.lat), double.parse(prediction.long)));
autocompletePlaces.clear();
}
}
发布于 2021-12-07 08:13:40
这个问题是通过在没有空检查的情况下将String?
变量传递到String
参数引起的。
要绕过错误,可以执行以下操作:autocompletePlaces[index].description ?? ''
使变量成为String
https://stackoverflow.com/questions/70256252
复制相似问题