appsup-dart / firebase_admin

A pure Dart implementation of the Firebase admin sdk
Other
44 stars 50 forks source link

Both Iterable and Map spread elements encountered in ambiguous literal #18

Closed jpeiffer closed 3 years ago

jpeiffer commented 3 years ago

Dart: 1.13.4

package version: firebase_admin: ^0.2.0-dev.0

Including the repo gives this error:

.../.pub-cache/hosted/pub.dartlang.org/firebase_dart-1.0.0-dev.41/lib/src/database/impl/treestructureddata/treestructureddata.dart:59:14: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
        json = {...json.asMap()}..removeWhere((k, v) => v == null);

It looks like it can be fixed by giving the offending line a cast to explicitly tell the compiler the result is a Map and not a Set as follows:

      json = <dynamic, dynamic>{...json.asMap()}
        ..removeWhere((k, v) => v == null);
jpeiffer commented 3 years ago

Oops. This is actually coming from firebase_dart. Closing this issue and I'll open a new one there.