firebase / firebase/firebase-admin-dart

Share/Unify `Timestamp` between `google_cloud_firestore` and `cloud_firestore`

Open
#286 4 comments 1 reaction 0 assignees View on GitHub
blocked bug
Dominant language
Dart
Stars
177
Forks
70
Avg merge
5d 14h
Merged PRs (30d)
6

Description

# Proposal: Share/Unify `Timestamp` between `google_cloud_firestore` and `cloud_firestore`

### Problem
When building full-stack Dart applications (Flutter on the client, Dart VM/Firebase Functions on the server), sharing data models with Firestore timestamps is highly problematic.

* `cloud_firestore` (specifically `cloud_firestore_platform_interface`) and `google_cloud_firestore` (`firebase-admin-dart`) define their own incompatible `Timestamp` classes.
* Even though they have the same underlying structure (`seconds` and `nanoseconds`), Dart's static type system treats them as completely separate types.
* As a result, shared models cannot run simple type checks (like `value is Timestamp`) without introducing Flutter dependencies to the backend. Developers must rely on brittle workarounds like string-based runtime type checking (`value.runtimeType.toString().contains('Timestamp')`).

### Proposed Solution
We highly recommend extracting basic, pure Dart Firestore types (such as `Timestamp` and `GeoPoint`) into a lightweight, neutral package (e.g., `firebase_common_types`) with no dependencies on Flutter or VM-specific APIs.

Both `cloud_firestore` and `google_cloud_firestore` should then depend on and re-export these shared types. This will enable clean, type-safe full-stack Dart development.

Contributor guide

Open the contributing guide

Research direction

Start by comparing the Timestamp definitions in cloud_firestore_platform_interface and firebase-admin-dart, then investigate whether a neutral pure-Dart package can host the shared types. Done means both cloud_firestore and google_cloud_firestore depend on and re-export compatible types without Flutter or VM-specific dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.