Marc Hughes


Home
Blog
Twitter
LinkedIn
GitHub
about
I am a developer from a bit west of Boston.

Dart Mixins, JSON and Logging

02 Jan 2014

I've been learning Dart for a couple days now and am liking it so far. Today, I made a couple mixins that might be useful to others that I thought I'd share.

The first is a logging mixin that adds a log property, it uses reflection to set the classname of the logger to the current class.

The second adds a fromJSON and toJSON method for serializing/deserializing data from web services without writing a ton of boilerplate code.

Code is below, with an example at the end.