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.
Proposal: Share/Unify
Timestampbetweengoogle_cloud_firestoreandcloud_firestoreProblem
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(specificallycloud_firestore_platform_interface) andgoogle_cloud_firestore(firebase-admin-dart) define their own incompatibleTimestampclasses.secondsandnanoseconds), Dart's static type system treats them as completely separate types.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
TimestampandGeoPoint) into a lightweight, neutral package (e.g.,firebase_common_types) with no dependencies on Flutter or VM-specific APIs.Both
cloud_firestoreandgoogle_cloud_firestoreshould then depend on and re-export these shared types. This will enable clean, type-safe full-stack Dart development.