发生异常。 NoSuchMethodError (NoSuchMethodError: The method '[]' was called on null. Receiver: null Tried calls: []("id"))

时间:2021-03-08 16:24:52

标签: firebase flutter google-cloud-firestore

发生异常。 NoSuchMethodError (NoSuchMethodError: The method '[]' was called on null. 接收器:空 试过打电话:) 在这个函数中它正在发生:

 loadSingleRestaurant({String restaurantId}) async {
    restaurant = await _restaurantServices.getRestaurantById(id: restaurantId);
    notifyListeners();
  }

这是 getRestaurantById 函数:

Future<RestaurantModel> getRestaurantById({String id}) =>
      _firestore.collection(collection).document(id).get().then((doc) {
        return RestaurantModel.fromSnapshot(doc);
      });

如果您需要任何其他信息,请告诉我

0 个答案:

没有答案
相关问题