Coder Social home page Coder Social logo

firedart's People

Contributors

bierbaumtim avatar cachapa avatar cenomla avatar dev-tryit avatar eximius313 avatar fum36205 avatar guyluz11 avatar kirpal avatar nullbtb avatar saadardati avatar simonbengtsson avatar willhlas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

firedart's Issues

getUser() crashes when token is invalid

Hey there,
I am having some issues trying to catch and process errors. I have an error class I had been using to catch errors and return UI/log messages with some things like the following:

// Error classes
class FBErrorCodes {
  static const InvalidPasswordCode = "INVALID_PASSWORD";
  static const UserNotFoundCode = "USER_NOT_FOUND";
  ... // etc   
}

class FBError extends Error {
 static String exceptionMessage(dynamic exception) {
      if (exception is String) {
        if (!kReleaseMode) _log.d(exception);
        return exception;
      }

      if (exception.toString().contains(FBErrorCodes.InvalidPasswordCode)) return "Invalid password. Please try again.";
      if (exception.toString().contains(FBErrorCodes.UserNotFoundCode)) return "User not found.";
      ... // etc   
    }
}

I ran into my first error though when testing some things, but it died out in UserGateway.getUser() with a forced breakpoint in Android Studio:

NoSuchMethodError: The method '[]' was called on null.
Receiver: null
Tried calling: [](0)

I had deleted my user from Firebase, then restarted my app without having performed the SignOut() function within the package, so the user information was still within the Hive storage, so when it went to start back up and silently log in, it caused an error, but it wasn't caught by my catchError, and so far none of them have been able to be caught when I have tried (ex. incorrect password, etc).

This was what I was attempting to do. Is there some other way I am supposed to go about handling this? I feel like I might be missing something.

    // Auth service
    user = await auth.getUser().catchError((e) {
      return FBError.exceptionMessage(e);
    });

Thanks,
-MH

FirebaseAuth.signInState returns null instead of false

The FirebaseAuth.signInState stream seems to return null instead of false when the user is not logged in.
The Stream is of type bool as you can see: Stream<bool> get signInState, so it should not be able to return null.
In my case, because of the way Riverpod works when listening to streams, I am constantly stuck in a loading part where it is waiting for a non-null value.

Any idea on how to fix this for now?

Does initialize with hive working in null safety project

I am initializing firebase auth with hive FirebaseAuth.initialize(_fireBaseApiKey!, await HiveStore.create());

Based my code from her.
Now after updating dart to null safety version I get this error

type 'Null' is not a subtype of type 'Token' in type cast

on this line HiveStore._internal(box);.

Did someone tested this in null safety environment ?.

RPi stream close automatically after some time

I have an app running forepart plugin on a RPi with flutter-pi. I use firebaseCollection.document(docName!).stream to load the database value from firebase.
I tried using wifi or network cable but I still have this issue, so is not linked to issue
My code is

StreamBuilder<....>(
        stream: firebaseCollection.document(docName!).stream,
        builder: (context, snapshot) {
          if (snapshot.hasData) {
      ////
}
else {
            return Center(child: CircularProgressIndicator());
          }
        },
      ),

Any workaround to solve this issue with more code or implementation for firedart?

UserCollection class not found

Peek Problem message from Editor: Undefined name 'UserCollection'.
Try correcting the name to one is defined...........

My pubspec.yaml
tempsnip

My main.dart where I set the project id
tempsnip2

Where I really used Firedart Package and getting the error by calling UserCollection class.
Pleass help me.
tempsnip3

No internet error

When I don't have internet I get this exception.

Unhandled exception:
SocketException: Failed host lookup: 'www.googleapis.com' (OS Error: Temporary failure in name resolution, errno = -3)
#0      IOClient.send (package:http/src/io_client.dart:33:23)
<asynchronous suspension>
#1      KeyClient.send (package:firedart/auth/client.dart:56:19)
#2      BaseClient._sendUnstreamed (package:http/src/base_client.dart:169:38)
<asynchronous suspension>
#3      BaseClient.post (package:http/src/base_client.dart:54:7)
#4      AuthGateway._post (package:firedart/auth/auth_gateway.dart:41:33)
<asynchronous suspension>
#5      AuthGateway._auth (package:firedart/auth/auth_gateway.dart:32:21)
<asynchronous suspension>
#6      AuthGateway.signIn (package:firedart/auth/auth_gateway.dart:16:7)
<asynchronous suspension>
#7      FirebaseAuth.signIn (package:firedart/auth/firebase_auth.dart:56:20)
#8      CloudFireStore.listenToChangeOfDataInPath (package:SmartDeviceDart/shered/data_base/cloud_fire_store.dart:46:16)
<asynchronous suspension>
#9      DataBaseController.listenToChangeOfDataInPath (package:SmartDeviceDart/shered/data_base/data_base_controller.dart:27:27)
<asynchronous suspension>
#10     CloudManager.listenToDataBase (package:SmartDeviceDart/shered/data_base/cloud_manager.dart:14:24)
#11     SmartDeviceManager.listenToDataBase (package:SmartDeviceDart/smart_device/smart_device_manager.dart:49:18)
#12     SmartDeviceManager.SmartDeviceMainAsync (package:SmartDeviceDart/smart_device/smart_device_manager.dart:21:5)
<asynchronous suspension>
#13     new SmartDeviceManager (package:SmartDeviceDart/smart_device/smart_device_manager.dart:13:5)
#14     main (file:///home/guyl/Documents/programing/git/SmartHome/SmartDevice/SmartDeviceDart/bin/main.dart:18:3)
<asynchronous suspension>
#15     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:303:32)
#16     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

signInWithCustomToken is not implemented

Currently, it is possible to signIn by email/password or anonymously.
But in "native" FirebaseAuth it is possible to FirebaseAuth.instance.signInWithCustomToken and use server-generated token.

As far as I understand, it is possible to add to auth_gateway.dart something like

Future<User> signInWithCustomToken(String token) async =>
      _auth('signInWithCustomToken', {'token': token, 'returnSecureToken':"true"});

as described in https://cloud.google.com/identity-platform/docs/use-rest-api#section-verify-custom-token

This call does not return localId, but it is expected in auth_gateway.dart. Not sure whether it is required here at all.

firestore.collection('Collection_name').get() only returns 20 items

Hello, thanks for create this package.

I'm using the latest version from pub.dev firedart: 0.6.5
But I have an issue related to the limit of the documents from any collection.

I tried with different collections and the maximum items returned are 20. Are there any limit/restrictions about that?

This is my implementation:

  final firebaseAuth = FirebaseAuth(apiKey, VolatileStore());
  final firestore = Firestore(projectId, auth: firebaseAuth);
  await firebaseAuth.signIn(email, password);
  final t = await firestore.collection('Airport').get();
  print("T: ${t.length}");

I tried with different collections and the maximum number of documents returned is 20.

Migrate code to NNBD

I know this may be a long shot, but is there any way you can think of to get this to nnbd?

Streams are getting crossed?

Sorry, think I've found another bug :(

I have a structure like (books/BOOK_ID/pages):
image

When using this stream inside a streamBuilder:

_pageStream = Firestore.instance.collection("users/[email protected]/books/$selectedBookId/pages").stream;

I get 3 calls to builder:

  1. First call has no data
  2. Second call is correct data (5 pages)
  3. Third call is a combination of data from 2 collections (5 pages + 7 books). The books stream was created on the previous route.

The 2nd and 3rd calls appear to happen in the same frame.

image

You shouldn't need to await .doc()

Firestore makes it so you can get a document reference without marking it as a write. It's just a reference to the document without any data, so no sub collection and no fields/maps.

The way to get the data is to do doc(...).get(). This is marked as a read by firestore.

The way we have it in firedart is doc(...) directly gets the data, and if you want to set data you have to do (await doc(..)).set(...). This is supposedly marked as a read and a write. Very unnecessary and unexpected behavior.

How to cancel document .listen stream correctly

I am trying to get pass #43 for now.
So I am restarting the stream each hour using

 Timer.periodic(const Duration(minutes: 1), (Timer t)  {
      print('Restarting stream');
      listenToDataBaseHelper();
    });

I have static var in the class static StreamSubscription<Document> listenToDataBaseStream; that I use to save the stream and cancel it before creating the new one like this:

await listenToDataBaseStream?.cancel();
listenToDataBaseStream = _cloudValueChangeEntity.listenToDataBase().listen((document) {

But I found out that .cancel on the stream does not remove the Snapshot listeners and I get ever increasing spikes in Snapshot listeners and Reads as there are a lot of listeners that are not canceled.

image

How should I cancel .listen stream correctly.

[Web] gRPC Error (code: 14, codeName: UNAVAILABLE, message: Error connecting: Unsupported operation: SecurityContext constructor)

Firestore seems be be throwing errors when deployed to Web.

Calling something like:
Firestore.instance.collection("users").get() is triggering:

Restarted application in 201ms.
Error: gRPC Error (code: 14, codeName: UNAVAILABLE, message: Error connecting: Unsupported operation: SecurityContext constructor, details: null)
    at Object.createErrorWithStack (http://localhost:64615/dart_sdk.js:4362:12)
    at Object._rethrow (http://localhost:64615/dart_sdk.js:38245:16)
    at async._AsyncCallbackEntry.new.callback (http://localhost:64615/dart_sdk.js:38239:13)
    at Object._microtaskLoop (http://localhost:64615/dart_sdk.js:38071:13)
    at _startMicrotaskLoop (http://localhost:64615/dart_sdk.js:38077:13)
    at http://localhost:64615/dart_sdk.js:33574:9

The same code is working great on Desktop, and FirebaseAuth works on both Web/Desktop.

Firestore.instance.collection(path).stream stop working after changing WiFi network

I am initializing Firestore and calling Firestore.instance.collection(path).stream and it is working.

If I change network while the app is running and calling Firestore.instance.collection(path).stream again new collection values are not arriving when being changed.

The last stream was canceled before the new one was being called.

Is there part of the library that fixed on the network that he got when it was initialized like the httpClient?.

Display Collection as a List

image

I want to make a list based on my collection like picture above
but the thing is firedart dsnt return document snapshot How I can display that ? because I using Map<String, dynamic >
the return Type is Page document level not a Map<String, dynamic>

400: Bad Request running signIn()

I was making tests to test my verifyIdToken implementation in Dartbase Admin SDK. Naturally, I needed to acquire a user id token first and the only way to do that is from a client. So I used firedart as a dev-dependency for testing only and ran the following code:

  setUpAll(() async {
    await Firebase.initialize(projectId, await ServiceAccount.fromFile(serviceAccountPath));

    fd.FirebaseAuth.initialize(webApiKey, fd.VolatileStore());

    await FirebaseAuth.initialize();
  });

  test('Verify Token', () async {
    await fd.FirebaseAuth.instance.signIn(email, pass);
    var token = await fd.FirebaseAuth.instance.tokenProvider.idToken;

    var id = await FirebaseAuth.instance.verifyIdToken(token);
    expect(id != null, true);
    print(id);
  });

crash at: await fd.FirebaseAuth.instance.signIn(email, pass);
with the following message:

package:firedart/auth/auth_gateway.dart 48:7  AuthGateway._post

Exception: 400: Bad Request

Which is right here:
https://github.com/cachapa/firedart/blob/master/lib/auth/auth_gateway.dart#L37-L52

Recommended way to renew authentication token

I think that after number of days the authentication token is invalid and it crashing my program when trying to send to firesore.

Is there recommended way to renew the authentication token when it is expired?.

Transactions and Increment Value

Hello @cachapa,

I am ussing firedart to work on a WIndows Flutter application.

Is there a way to use Transactions and/or Increments with this package?
If so, can someone share a Link or minimal example to implement those behaviors.

If not, is there a workaround of some sort possible?

Thank you in advance for your help!

Mark

Cannot login

IM just trying this out on flutter desktop and getting the error AuthException: EMAIL_NOT_FOUND even though I'm using my correct email.

Im just using the example from docs, some of the code below:

FirebaseAuth.initialize(apiKey, VolatileStore());
    Firestore.initialize(projectId); // Firestore reuses the auth client
    auth = FirebaseAuth.instance;
    await auth.signIn(email, password);
    auth.signInState.listen((state) => print("Signed ${state ? "in" : "out"}"));

    // Get user object
    var user = await auth.getUser();
    print(user);

Error when trying to use the example Hive tokenstore

Edit ------- It looks like, for the last part of this post, within the Token class, changing it to the following fixed it: There are still the few other things below, which are just small tweaks. I am not sure if having to do HiveStore.create() as opposed to just using HiveStore() is intended. It's getting a bit late for me tonight, but I can try to do a PR tomorrow unless you get to it first.

Token.fromMap(Map<dynamic, dynamic> map)

// and also
Map<dynamic, dynamic> toMap()

// Original

Hey there,
I came across this package today and was rather excited to see that I won't have to use the web API Frankenstein setup I have been using, lol. I wanted to give Hive a try as well, as I had not heard of it prior(I was currently just using the package cross_local_storage as it works on Desktop), it looks like there may have been a change or two since the example was made?

When I first put it in my project, I got warning and the following was generated for the TokenAdapter extends TypeAdapter class:

  @override
  // TODO: implement typeId
  int get typeId => throw UnimplementedError();

It also looks like Hive.registerAdapter() may now just be:

void registerAdapter<T>(TypeAdapter<T> adapter)

The example also showed:

FirebaseAuth.initialize(apiKey, await HiveStore());

But it was saying there was no constructor, but it accepted:

FirebaseAuth.initialize(apiKey, await HiveStore.create());

All errors were gone at that point and I went ahead to run it. Everything fired up just fine, my test account logged in, an auth_store.hive/.lock file were generated, which I am assuming meant all was good, as there were no errors or anything.

I closed and reran my app, at which point I was greeted by the following:

flutter: ┌───────────────────────────────────────────────────────────────────────────────────────────────────
flutter: │ type '_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'Map<String, dynamic>'
flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
flutter: │ #0   package:searcher_installer_go/data/models/hive_store.dart 41:59  TokenAdapter.read
flutter: │ #1   package:hive/src/binary/binary_reader_impl.dart 325:33           BinaryReaderImpl.read
flutter: │ #2   package:hive/src/binary/binary_reader_impl.dart 273:26           BinaryReaderImpl.readFrame
flutter: │ #3   package:hive/src/binary/frame_helper.dart 17:26                  FrameHelper.framesFromBytes
flutter: │ #4   package:hive/src/io/frame_io_helper.dart 41:12                   FrameIoHelper.framesFromFile
flutter: │ #5   ===== asynchronous gap ===========================
flutter: │ #6   dart:async                                                       _asyncErrorWrapperHelper
flutter: │ #7   package:searcher_installer_go/main.dart 106:79                   runMain.<fn>
flutter: │ #8   package:provider/src/inherited_provider.dart 576:35              _CreateInheritedProviderState.value
flutter: │ #9   package:provider/src/inherited_provider.dart 439:33              _InheritedProviderScopeElement.value
flutter: ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄

Thanks!
-MH

Calling Document.stream causes unnecessary network activity

I've been doing some performance testing, and it seems the lack of local caching is a pretty major issue.

Without it, my app incurs many read calls each time a widget is rebuilt, for example, a StreamBuilder watching a 100 item collection, if the parent of that widget plays a 1s animation, you could incur 6000 read calls right there (60fps, 100 reads each frame). The same interaction with the native sdk shows 0 read calls.

I'm just curious if this is known behavior, or is there a better way to sync your UI to the stream.

Also any chance of local cache being added if this is the cause?
Cheers,

-10 points in pub.dev for not supporting grpc last version

This library get -10 points in pub.dev site for not including the last version of grpc dependence.

"Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (grpc)."

grpc_is_not_updated

verifyIdToken

Missing from firebase auth. Looked at firebase_admin's implementation and tried copying it over, turns out it's far too complicated. I don't know what classes they have correspond to classes we have.

Missed step in _handleError function?

In the _handleError function we have if statement that check for specific type of error, and if it does it is setting up the client again with call to the function _setupClient() in order to restart itself after the error I presume.
After _setupClient() was called (to handle the GrpcError) the code continue to the throw statement.

void _handleError(e) {
  print('Handling error $e using FirestoreGateway._handleError');
  if (e is GrpcError &&
      [
        StatusCode.unknown,
        StatusCode.unimplemented,
        StatusCode.internal,
        StatusCode.unavailable,
        StatusCode.unauthenticated,
        StatusCode.dataLoss,
      ].contains(e.code)) {
    _setupClient();
  }
  throw e;
}

I think we need to add return statement after calling _setupClient so that it will not crash the program, like this

void _handleError(e) {
  print('Handling error $e using FirestoreGateway._handleError');
  if (e is GrpcError &&
      [
        StatusCode.unknown,
        StatusCode.unimplemented,
        StatusCode.internal,
        StatusCode.unavailable,
        StatusCode.unauthenticated,
        StatusCode.dataLoss,
      ].contains(e.code)) {
    _setupClient();
    return;
  }
  throw e;
}

Related to #43 as I am getting the error

Handling error gRPC Error (code: 14, codeName: UNAVAILABLE, message: Missing trailers, details: null, rawResponse: null) using FirestoreGateway._handleError
Unhandled exception:
gRPC Error (code: 14, codeName: UNAVAILABLE, message: Missing trailers, details: null, rawResponse: null)

Asking this before creating pull request just to make sure that I am not missing anything.

Stream listen is not called when limit is added in Firestore query in Dart / Flutter

Stream listen is not called when limit is added in Firestore query in Dart / Flutter

I have used below code in my initState() function:

Stream<QuerySnapshot> xstream = FirebaseFirestore.instance
      .collection('messages')
      .where('encSenderUId', isEqualTo: _loggedInUserId)
      .where('encReceiverUId', isEqualTo: widget.encUId)
      .orderBy('messageId', descending: true)
      .startAt([_startAtTimestamp])
      .limit(1)
      .snapshots();

  xstream.listen((event) {   
    print('Hiii, I am listening..');

  }, onDone: () {
    print("Task Done single");

  }, onError: (error) {
    print("Some Error ${error.toString()}");

  });

Case 1: If I DO NOT use limit() in query then listen message is printed once when screen is rendered first time and also listen is called when something is changed in Firestore stream (eg. added new document / removed a document).

Case 2: If I use limit() in query then listen message is printed once when screen is rendered first time but listen is NOT called when something is changed in Firestore stream (eg. added new document / removed a document).

I have to use limit() to fetch one document according to set orderBy. I am 100% sure that limit() is not allowing stream to listen any event.

Kindly suggest how can I use limit with `listen' to fix this issue. Thanks a lot.

We got 'dart:io' back

Do we realy need the line
exit(0);
that exist in the file main.dart last line of code?.
That line use import 'dart:io'; and it is removing 10 points in pub.dev

image

Return Collection Data in List Form

Page data = await Firestore.instance.collection('Demo').get();

Here, Page Not support.
Collection data return List Format like, [/Demo/FcCFlfqedZUmGb4g9u1G {name: demo}, /Demo/f8pXXdGzqOh2awUKjm8t {name: test}].

Question in regards to email verification

Hey there,
I have a question about email verification. Does a callback mechanism or stream of some sort exist similar to 'auth.signInState.listen' or 'ref.stream.listen' in which I can detect if/when a user verifies their email address when submitting their signup request?

When I saw that there were some streams available within the package I was excited, as before I was just using all REST calls and I had the idea of, upon signup submission, having a "Please verify your email address to continue (or press cancel to return later)" screen in which I can have a listener for 'user.emailVerified'. Then once it changed, I could move them forward in my application right then and there as opposed to sending them back to the login and having them put in their credentials again after doing the verification.

If not, is there any other way to go about it that I might not be thinking of, or do I just need to go the route I was before and just have them login again once they do get their email? I suppose I could try setting up some sort of timer to recheck every 5-10 seconds or similar.

(One last side question about streams, as I am somewhat new to them. When using something like ref.stream.listen, do I need to manually terminate these in the likely event that the user closes the application while still logged in, or anything like that?)

Thanks!
-MH

firebase_auth_test.dart is failing

I was checking if I was attempting a sign in correctly and it seems that firebase_auth_test is failing on all tests...

image

I did not modify the auth_gateway or user_gateway, the _post method itself is failing for some reason. The data is correct as I compared it to the documentation and breakpointed the body map, it is using my email and password, and firebase auth is using my firebase web key.

@cachapa Can you please run firebase_auth_test and tell me if it passes? If it does, then the problem is on my side.

gRPC stream error when Token expires - Missing or invalid authentication.

Hi

Using latest 0.8.3 in Dart VM console app. (same issue with the previous version)

The app is listening to a collection stream. Works without any problems when the app is started, but after 1 hour (which is probably when the token expires), the following "listen onError" appears:

gRPC Error (code: 16, codeName: UNAUTHENTICATED, message: Missing or invalid authentication., details: [])

As a workaround, I have tried:

  • Sending collection updates every 5 minutes, which the stream receives without any problems for up to 1 hour.
  • Cancel the stream subscription when catching the onError and restarting the stream subscription. Still will not receive the stream updates.
  • Cancel the stream subscription when catching the onError, then log out, log back in, subscribe to the stream again, but it still refuses to receive the collection updates.

The rest of the once-off document updates (update and delete) still work without any problem after 1 hour, just the stream that is broken and which I can not seem to recover/reload.

I am not sure what is causing the error, but I am happy to just restart the stream. Is there a specific way to reinitialize the stream in firedart which I am not aware of?

I would appreciate any feedback or suggestions.

User.emailVerified always return null

Firedart.User.emailVerified always return null despite the fact that it is set to true or false for an authenticated user.

This was tested with version 0.9.0

thanks

Error if field name starts with integer in update() method

When I call ".update()" method in firestore, I get an error if I use a String that starts with an integer as the field name for a value:

gRPC Error (code: 3, codeName: INVALID_ARGUMENT, message: Invalid property path "1dMj8Dh8qGt4vFDBQEyJ"., details: [], rawResponse: null)

For example, the error throws when I try:
firebase.collection("any").document("any").update({"1dMj8Dh8qGt4vFDBQEyJ": "any"})

However, this error is not present when I try:
firebase.collection("any").document("any").set({"1dMj8Dh8qGt4vFDBQEyJ": "any"})

Also, the error is not present in update() method when I use any another field name not starting with an integer, for example:
firebase.collection("any").document("any").update({"AdMj8Dh8qGt4vFDBQEyJ": "any"})

[Firestore] Web: Memory Leak

I encounter a huge memory leak using firestore on the web. This means the process allocate around 4GB of RAM in around 2 minutes, before the browser stops it.

The problem occurs when I try to get a snapshot of an collection or using a stream of an collection.
I've create a small example app to reproduce the problem: https://github.com/bierbaumtim/firestore_memory_leak_repro. The rule of the firestore datastore currently allow reads until the end of this month and denies any write. If you no longer have access, let me know in a comment, and I will update the rule.

My first thought for a possible reason was that I used nested collections, but the issue also occours with a basic collection with documents. Both situations are covered by the example.

flutter doctor:

[√] Flutter (Channel beta, 1.19.0-4.2.pre, on Microsoft Windows [Version 10.0.19041.329], locale de-DE)
    • Flutter version 1.19.0-4.2.pre at C:\Users\x\Flutter\flutter_beta
    • Framework revision 9b9b543d92 (2 weeks ago), 2020-06-22 12:19:28 -0700
    • Engine revision 9a28c3bcf4
    • Dart version 2.9.0 (build 2.9.0-14.1.beta)

 
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) 
    • Android SDK at C:\Users\x\AppData\Local\Android\sdk
    • Platform android-R, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java       
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.46.1)
    • VS Code at C:\Users\x\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.12.1

[√] Connected device (1 available)
    • Web Server • web-server • web-javascript • Flutter Tools

! Doctor found issues in 1 category.

Admin API?

Does this work on the server to provide access to the firestore admin API?

I'd like to use this in a Cloud Run container to invoke firestore admin functions. Possible?

Moving to google's official auth

Some issues in this package could be due to our implementation of the auth token.
We currently not using the Google's official auth package, we are using REST-based auth that we implemented.

I found googleapis_auth google official auth package that we can use as dependency or get implementation ideas for from it.

I also found firebase_auth_rest which claims to

Uses the official REST-API endpoints
Supports automatic background refresh

firebase_auth_rest comes with implementation and googleapis_auth is as far as I understand only getting the OAuth2 credentials and we will need to implement talking to Firebase ourselves

Provides support for obtaining OAuth2 credentials to access Google APIs.

gRPC Error (13, Error making call: NoSuchMethodError: The getter '_expiry' was called on null.

Given the following code:

  void init() async {
    var tokenStore = VolatileStore();
    var auth = await FirebaseAuth('AIzaSyDc4GGbOb-<...>', tokenStore);
    firestore = await Firestore('<...>', auth: auth);
  }

I get the following error when trying to call firestore.document()

ERROR - 2020-05-13 17:55:47.418320
GET /user/get
Error thrown by handler.
gRPC Error (13, Error making call: NoSuchMethodError: The getter '_expiry' was called on null.
Receiver: null
Tried calling: _expiry)
[ERROR] 2020-05-13 17:55:47.040673	0:00:00.355121	GET	/user/get
gRPC Error (13, Error making call: NoSuchMethodError: The getter '_expiry' was called on null.
Receiver: null
Tried calling: _expiry)
dart:async                                                                  _StreamController.addError
package:grpc/src/client/call.dart 116:18                                    ClientCall._terminateWithError
package:grpc/src/client/call.dart 158:5                                     ClientCall._onMetadataProviderError
dart:async                                                                  _AsyncAwaitCompleter.completeError
package:firedart/firestore/token_authenticator.dart                         TokenAuthenticator.authenticate

I'm not sure what's going wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.