serializeData<T> function

Map<String, dynamic> serializeData<T>({
  1. required T data,
  2. required ToFirestore<T>? toFirestore,
})

Implementation

Map<String, dynamic> serializeData<T>({
  required T data,
  required ToFirestore<T>? toFirestore,
}) {
  if (data is Map<String, dynamic>) {
    return data;
  } else {
    assert(
      toFirestore != null,
      'A toFirestore function must be provivded for converted-type server updates.',
    );
    return toFirestore!(data, null);
  }
}