jolleekin / jsonx

An extended JSON library that supports the encoding and decoding of arbitrary objects.
BSD 2-Clause "Simplified" License
11 stars 6 forks source link

Add @MirrorsUsed example to README for jsonx clientside use #15

Closed ahirschberg closed 7 years ago

ahirschberg commented 8 years ago

Add an example to the README of importing jsonx with the @MirrorsUsed annotation for dart2js users. This library is useful without mirrors, but it can be confusing how to import it without incurring the size penalty of an unchecked dart:mirrors import when transpiling to JS.

giraldeau commented 7 years ago

And as of today in flutter, the import fails because of missing dart:mirror:

00:00 +0: loading /home/francis/gitsrc/evnavapp/test/jsonx_test.dart
Shell: [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] 'package:jsonx/jsonx.dart': error: line 7 pos 1: import of dart:mirrors with --enable-mirrors=false
jolleekin commented 7 years ago

This package is currently not working in Flutter and browsers other Dartium. Flutter doesn't support mirrors and dart2js doesn't support reflections on enums and generics.

I plan to rewrite this package using package reflectable but still need to think about how to support generics.