gcloud
gcloud copied to clipboard
Support for Cloud Datastore in Dart without relying on `dart:mirrors`
Description:
I'm currently using the gcloud
package in my Dart application to work with Cloud Datastore. However, I encountered an issue when trying to use the package with the Cloud Datastore due to the reliance on the dart:mirrors
package. The dart compile
command fails with the following error:
error: import of dart:mirrors is not supported in the current Dart runtime
Error: AOT compilation failed
Generating AOT snapshot failed!
I believe it would be beneficial to provide an alternative way to define Datastore models without relying on the dart:mirrors
package. This would enable the use of Cloud Datastore in Dart applications without encountering the reflection-related limitations imposed by the Dart runtime when calling dart compile
command.
In the documentation, the usage of the @db.Kind()
and @db.Property()
annotations from the gcloud
package is demonstrated. However, since Dart's AOT compilation does not support dart:mirrors
, it would be helpful to have an alternative approach for defining Datastore models that doesn't rely on reflection.
My use case:
I am trying to use the package to build a faas with functions-framework-dart . When building the tiny docker image, the dart compile
command fails if I use Datastore library.