Skip to content

Commit 696c1d0

Browse files
authored
Merge pull request #21 from davidmarne/typed_action_name_assignment
typed_action_name_assignment
2 parents 2b5b134 + f91c7c5 commit 696c1d0

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

lib/generator.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ String _generateActions(ClassElement element) {
6161
// generate the action name
6262
nameCode = _appendCode(
6363
nameCode,
64-
'static ActionName $fieldName = new ActionName<${_getActionDispatcherGenericType(e)}>(\'${element.name}-$fieldName\');\n',
64+
'static final ActionName<${_getActionDispatcherGenericType(e)}> $fieldName = new ActionName<${_getActionDispatcherGenericType(e)}>(\'${element.name}-$fieldName\');\n',
6565
);
6666

6767
// generate the dispatcher
6868
var actionDispatcher =
6969
'\n${e.toString()} = new ActionDispatcher<${_getActionDispatcherGenericType(e)}>(\'${element.name}-$fieldName\');\n';
7070

7171
// if it was not declared final make it final
72-
if (_isGeneratedDispatcherFinal(actionDispatcher))
72+
if (!_isGeneratedDispatcherFinal(actionDispatcher))
7373
actionDispatcher = '\nfinal $actionDispatcher';
7474

7575
// append the action dispatcher to the class definition
@@ -85,7 +85,7 @@ String _generateActions(ClassElement element) {
8585
// generate the instantiation
8686
initializerCode = _appendCode(
8787
initializerCode,
88-
'${e.toString()} = new $typeName();',
88+
'final ${e.toString()} = new $typeName();',
8989
);
9090

9191
// append the sync function for this set of actions

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: built_redux
2-
version: 2.1.1
2+
version: 2.1.2
33
description:
44
A state management library written in dart that enforces immutability
55
authors:

test/unit/test_counter.g.dart

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)