dart-lang/gcloud

Is this library compatible with flutter?

DhavalRKansara opened this issue · 5 comments

I have tried to implement this library with a flutter project and got the below errors:

E/flutter ( 1549): [ERROR:flutter/shell/common/shell.cc(178)] Dart Error: error: import of dart:mirrors is not supported in the current Dart runtime
E/flutter ( 1549): [ERROR:flutter/shell/common/engine.cc(188)] Could not prepare to run the isolate.
E/flutter ( 1549): [ERROR:flutter/shell/common/engine.cc(127)] Engine not prepare and launch isolate.
E/flutter ( 1549): [ERROR:flutter/shell/common/shell.cc(407)] Could not launch engine with configuration.

My pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  gcloud: ^0.6.3

Even though googleapis_auth is already present in dev_dependencies of gcloud package still when I tried to import 'package:googleapis_auth/auth_io.dart' as auth; it gives me the following error: Target of URI doesn't exist: 'package:googleapis_auth/auth_io.dart'.

I have tried to implement this library with a flutter project and got the below errors:

The gcloud package uses dart:mirrors that is not supported in the Flutter runtime. That should be explained in the readme. I'll keep this issue open for that.

Even though googleapis_auth is already present in dev_dependencies of gcloud package still when I tried to import 'package:googleapis_auth/auth_io.dart' as auth; it gives me the following error: Target of URI doesn't exist: 'package:googleapis_auth/auth_io.dart'.

You do not get the dev_dependencies of your dependencies with pub get.
The dev_dependencies of package:foo are packages you need for developing package:foo (usually for testing or generating code), not for using it.

Furthermore it is in general not the best practice to depend on your dependencies' dependencies. If you want to refer to something from package:foo in your own package, add it as an explicit dependency.

If your want to use package:googleapis_auth from your package, add it to the dependencies of your own package.

@sigurdm Thanks for your reply.

So, Is there any other way by which I can establish a connection with Google Cloud pub-sub?

I think https://pub.dev/packages/googleapis is currently your best bet...

@sigurdm You should mention explicitly that dart:mirrors also breaks dart2native -- that isn't addressed by #85.

Use case: I want to deploy a minimal container using package:appengine. (rationale here)

related: #24