We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dart_mappable: ^0.9.1
Hi there, writing my own CustomMapper I have a suggestion for the documentation.
CustomMapper
Maybe something along the lines below, demonstrating the handling of a slightly more complex situation involving custom objects and not just a String.
The current example shows decode: return (value as String) which may be outdated?
decode: return (value as String)
-------------------------------------------------- @CustomMapper() class ItemRefMapper extends SimpleMapper<ItemRef> { ItemRefMapper(); final String key = 'aSuperJsonKey'; @override ItemRef decode(dynamic value) { return ItemRef(value[key]); } @override dynamic encode(ItemRef self) { return {key: self.val}; } } class ItemRef { String val; ItemRef(this.val); @override String toString() { return val; } } @MappableClass(discriminatorKey: 'type') abstract class Data { ItemRef itemRef; Data(this.itemRef); } @MappableClass() class DataImpl extends Data { DataImpl(ItemRef itemRef) : super(itemRef); }
The text was updated successfully, but these errors were encountered:
Thanks for the feedback.
Maybe to both keep it simple and have a meaningful example, I could show a custom mapper for some core dart class, like Uri or BigInt?
Uri
BigInt
Sorry, something went wrong.
Sure! Showing that a HashMap may be returned in decode would be helpful. I was not so sure what to expect and how to make it work in the beginning.
decode
Thanks!
No branches or pull requests
dart_mappable: ^0.9.1
Hi there, writing my own
CustomMapper
I have a suggestion for the documentation.Maybe something along the lines below, demonstrating the handling of a slightly more complex situation involving custom objects and not just a String.
The current example shows
decode: return (value as String)
which may be outdated?The text was updated successfully, but these errors were encountered: