title: Anonymous Objects with Strongly Type Properties in Dart and Flutter
body: <p>I am using the following code in my Dart which uses redux and flutter_redux packages. Everything works fine but as you can see I have to use the following syntax to call the appropriate action.  </p>
  
  <pre><code>callback['onIncrement'](34) 
  </code></pre>
  
  <p>It works but it is ugly. How can I improve it so it reads more like this: </p>
  
  <pre><code>callback.onIncrement(34)
  </code></pre>
  
  <p>Here is the code: </p>
  
  <pre><code>StoreConnector&lt;AppState,Map&lt;String,Function&gt;&gt;(
      converter: (store) {
        return {
          'onIncrement': (value) =&gt; store.dispatch(IncrementAction(value)), 
          'onDecrement': () =&gt; store.dispatch(Actions.decrement)
        };
      },
      builder: (context, callback) {
        return Column(
          children: &lt;Widget&gt;[
            FlatButton(
            child: Text('Increment Counter', style: TextStyle(color: Colors.white)),
            color: Colors.orange, 
            onPressed: () =&gt; callback['onIncrement'](1)
  </code></pre>
  
  <p>UPDATE: </p>
  
  <p>Now, I am using enums and it is little better: </p>
  
  <pre><code>StoreConnector&lt;AppState,Map&lt;Actions,Function&gt;&gt;(
          converter: (store) {
            return {
              Actions.increment: (value) =&gt; store.dispatch(IncrementAction(value)), 
              Actions.decrement: () =&gt; store.dispatch(Actions.decrement)
            };
          },
          builder: (context, callback) {
            return Column(
              children: &lt;Widget&gt;[
                FlatButton(
                child: Text('Increment Counter', style: TextStyle(color: Colors.white)),
                color: Colors.orange, 
                onPressed: () =&gt; callback[Actions.increment](23)
  </code></pre>