-
-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
bugSomething isn't workingSomething isn't workingflutter.webissue occurs only in flutter web targetissue occurs only in flutter web target
Description
Given this code
import 'package:dart_json_mapper/json_mapper.dart';
import 'package:dart_json_mapper/annotations.dart';
import 'main.reflectable.dart';
@jsonSerializable
class TridaA {
TridaA() {
print("TridaA constructed");
}
String prop;
}
void main() async {
// inicializace reflektoru
initializeReflectable();
print(".main");
jsonSerializable.annotatedClasses.forEach((cls) {
print("Annotated class ${cls.qualifiedName}");
});
print("allClasses ${jsonSerializable.annotatedClasses}");
var mirror = jsonSerializable.annotatedClasses.firstWhere((cm) {
print(" class ${cm.simpleName} ~ ${cm.reflectedType.toString()}");
return cm.simpleName == "TridaA";
});
print("Instance by reflection: ${mirror.newInstance("", [], {})}");
var map = Map<String, dynamic>.from({"b": Map<String, dynamic>.from({"prop": "test"})});
var instance = JsonMapper.instance
.deserializeObject(map, TridaA);
print("Instance by JsonMapper: ${instance}");
}
Everything is OK if it is built with dartdevc, but when compiled with dart2js by:
webdev serve web:43751 --hot-reload --release
with minification, it raise error:
Uncaught It seems your class 'minified:a6' has not been annotated with @jsonSerializable
at Object.c (localhost:43751/main.dart.js:2719:3)
at bX.a2 (localhost:43751/main.dart.js:5437:20)
at bX.bB (localhost:43751/main.dart.js:5442:30)
at localhost:43751/main.dart.js:6122:49
at ef.a (localhost:43751/main.dart.js:3678:72)
at ef.$2 (localhost:43751/main.dart.js:3804:23)
at Object.jI (localhost:43751/main.dart.js:3659:3)
at Object.fD (localhost:43751/main.dart.js:6124:10)
at localhost:43751/main.dart.js:6532:8
at localhost:43751/main.dart.js:6527:55
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingflutter.webissue occurs only in flutter web targetissue occurs only in flutter web target