Closed RobertBlackhart closed 10 years ago
It seems the static implementation of mapper is not decoding DateTime objects correctly. I'll take a look at that.
When you run your code in Dartium, without running the transformer, it uses a different (dynamic) implementation, which seems to not be affected by this problem. Although, this implementation relies on the mirrors API, which can cause problems when compiled to Javascript.
I've just published redstone_mapper v0.1.6 with a fix for this problem. Can you try it again?
I've just been able to try it again. I did a pub upgrade
on both the server and the client and pulled in the new mapper package (0.1.6). Re-ran the code with the same results (same error message and stack trace). The problem still appears when using the transformer and disappears when removing the transformer.
I take that last comment back. For whatever reason it is now working as expected (while having the transformer active). I can't really explain why it didn't work before other than something must have been cached.
I can also confirm that it works correctly when compiled to JS (and does not produce a bloated JS file).
Thanks! I'm trying to figure out how to automate tests for the static implementation (currently, only the dynamic implementation is covered by unit tests) so we can avoid errors like this.
I am writing the client side of my application. In it I am requesting from the server a list of Auctions which are being encoded like this:
The Auction class looks like this (on both ends):
The client-side code looks like this:
My pubspec.yaml file has the redstone_mapper transformer listed (as suggested):
However, when running the client, it throws an exception:
It looks like it's trying to parse the right thing, but it's failing to do the DateTime's correctly. The odd thing to me is that if I remove the redstone_mapper transformer, it runs without error and produces a correct result (I can manipulate the DateTime objects that are returned). Unfortunately, when compiling via
pub build
it does not run either way (with or without the transformer).Am I doing something wrong with my code or is there a problem where the transformer is stripping out some class that is needed to decode the DateTime objects?