flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

feat(cloud_firestore): Create a `cloud_firestore_types` package that can be used in dart-only contexts

Open Rexios80 opened this issue 1 year ago • 7 comments
trafficstars

Description

I am working on Dart code that gets transpiled to javascript. I'm having issues compiling because my model classes use these types, and thus transitively depend on Flutter.

Prequel to https://github.com/firebase/flutterfire/pull/13216

Related Issues

https://github.com/firebase/flutterfire/issues/13214

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [x] My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • [x] All existing and new tests are passing.
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] The analyzer (melos run analyze) does not report any problems on my PR.
  • [x] I read and followed the Flutter Style Guide.
  • [x] I signed the CLA.
  • [x] I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • [ ] Yes, this is a breaking change.
  • [x] No, this is not a breaking change.

Rexios80 avatar Aug 25 '24 03:08 Rexios80

Meh I'm not sure this actually improves the state of things

Rexios80 avatar Aug 25 '24 05:08 Rexios80

Actually I think having these available would help with json serialization

Rexios80 avatar Aug 25 '24 15:08 Rexios80

Description

Je travaille sur du code Dart qui est transposé en javascript. J'ai des problèmes de compilation car mes classes de modèle utilisent ces types et dépendent donc de manière transitive de Flutter.

Préquelle de #13216

Questions connexes

#13214

Liste de contrĂ´le

Avant de créer cette demande de tirage, vérifiez qu'elle répond à toutes les exigences énumérées ci-dessous en cochant les cases correspondantes ( [x]). Cela garantira un processus de révision fluide et rapide. La mise à jour des journaux des pubspec.yamlmodifications et des modifications n'est pas requise.

  • [x] J'ai lu le Guide du contributeur et suivi le processus qui y est dĂ©crit pour soumettre des PR.
  • [x] Mon PR inclut des tests unitaires ou d'intĂ©gration pour tous les comportements modifiĂ©s/mis Ă  jour/corrigĂ©s (voir le Guide du contributeur ).
  • [x] Tous les tests existants et nouveaux sont rĂ©ussis.
  • [x] J'ai mis Ă  jour/ajoutĂ© la documentation pertinente (commentaires de documentation avec ///).
  • [x] L'analyseur ( melos run analyze) ne signale aucun problème sur mon PR.
  • [x] J'ai lu et suivi le guide de style Flutter .
  • [x] J'ai signĂ© le CLA .
  • [x] Je suis disposĂ© Ă  donner suite aux commentaires d'Ă©valuation dans les meilleurs dĂ©lais.

Changement radical

Votre PR exige-t-il que les utilisateurs de plugins mettent à jour manuellement leurs applications pour s'adapter à votre changement ?

  • [ ] Oui, c’est un changement radical.
  • [x] Non, ce n’est pas un changement radical.

milyes avatar Aug 27 '24 12:08 milyes

I would like to include DocumentReference in this package as well since that can be in model classes, but that class seems to be more complex. Would making a base class maybe work?

Rexios80 avatar Aug 27 '24 12:08 Rexios80

Hello @Rexios80, I'm not sure it will be used by other people and thus might not be useful to include it directly in the main FlutterFire repository. Would using a fork directly on your side be easier?

Lyokone avatar Aug 27 '24 13:08 Lyokone

@Lyokone If cloud_firestore doesn't use the types from this package then it might as well not exist. I plan on using these in my own published packages, so it needs to be published as well. I'm working on firebase_js_interop which allows you to write Firebase Cloud Functions in Dart. I hope that would be a popular enough use-case to warrant this change. This isn't the first time I've run into this issue, but last time I found a workaround. Having a cloud_firestore_types package would allow me to remove the workaround package firebase_rules_convert.

I need to be able to create json converters from the cloud_firestore types to the js_interop types, but I can't do that since cloud_firestore depends on flutter.

Rexios80 avatar Aug 27 '24 13:08 Rexios80

@Lyokone Do you need anything from me on this?

Rexios80 avatar Sep 12 '24 16:09 Rexios80

Closing due to lack of interest. I still think this would be useful for dart-only firebase usage, so please let me know if you want to continue work on this.

Rexios80 avatar Apr 30 '25 13:04 Rexios80