Hi, just wanted to let you know something that I ran into and the solution. I was using a import "dart:core" as core; in my model class, for some reason. This made the dartson code not being able to find Map. The solution is not to do this weird import of dart built-in types. Maybe there is something you can do or warn about this, maybe not. Otherwise this is just for reference.
Exception:
void dartsonEntityDecode(Map obj, TypeTransformerProvider dson) {
^
type '_CompactLinkedHashMap' is not a subtype of type 'malformed' of 'obj'.
Stack Trace:
#0 Project.dartsonEntityDecode (package:test_arrays_binding/model_project.dart:56:30)
#1 Dartson.map (package:dartson/dartson_static.dart:74:32)
#2 Project.Project.fromJsonString (package:test_arrays_binding/model_project.dart:29:34)
#3 PaneEdit.PaneEdit.created.<anonymous closure> (package:test_arrays_binding/pane_edit.dart:19:21)
#4 _RootZone.runUnaryGuarded (dart:async/zone.dart:1093)
#5 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
#6 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:270)
#7 _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:362)
#8 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:237)
#9 Query._createStream.startListen.<anonymous closure> (package:firebase/src/firebase.dart:519:23)
Part of my model class code:
import 'package:polymer/polymer.dart';
import "dart:core" as core;
import 'package:dartson/dartson.dart';
/** Not documented yet. */
@Entity()
class Project extends Observable{
/** Not documented yet. */
@observable core.String hash;
/** Not documented yet. */
@observable core.String name = "New Project";
/** Not documented yet. */
@Property(ignore:true)
@observable core.List<Category> categories = toObservable([]);
//Project(this.hash, this.name, this.categories);
Project.create(hash) : hash = hash, name = "New Project",categories = toObservable([]);
Project.empty();
Project();
factory Project.fromJsonString(string){
return new Dartson.JSON().map(string, new Project());
}
toString() => name;
}
Hi, just wanted to let you know something that I ran into and the solution. I was using a
import "dart:core" as core;
in my model class, for some reason. This made the dartson code not being able to find Map. The solution is not to do this weird import of dart built-in types. Maybe there is something you can do or warn about this, maybe not. Otherwise this is just for reference.Exception:
Part of my model class code: