fromJson method

  1. @override
UApplyWritesResult fromJson(
  1. Map<String, dynamic> json
)

Implementation

@override
UApplyWritesResult fromJson(Map<String, dynamic> json) {
  try {
    if (isCreateResult(json)) {
      return UApplyWritesResult.createResult(
        data: const CreateResultConverter().fromJson(json),
      );
    }
    if (isUpdateResult(json)) {
      return UApplyWritesResult.updateResult(
        data: const UpdateResultConverter().fromJson(json),
      );
    }
    if (isDeleteResult(json)) {
      return UApplyWritesResult.deleteResult(
        data: const DeleteResultConverter().fromJson(json),
      );
    }

    return UApplyWritesResult.unknown(data: json);
  } catch (_) {
    return UApplyWritesResult.unknown(data: json);
  }
}