update method

  1. @override
Future<ChatModel> update(
  1. ChatModel value
)
override

Implementation

@override
Future<ChatModel> update(ChatModel value) {
  return chatCollection
      .doc(value.documentID)
      .update(value
          .toEntity(appId: appId)
          .copyWith(
            timestamp: FieldValue.serverTimestamp(),
          )
          .toDocument())
      .then((_) => value)
      .then((v) async {
    var newValue = await get(value.documentID);
    if (newValue == null) {
      return value;
    } else {
      return newValue;
    }
  });
}