{"action":"created","comment":{"url":"https://api.github.com/repos/alexeieleusis/greencat/pulls/comments/84204036","pull_request_review_id":4995310,"id":84204036,"diff_hunk":"@@ -0,0 +1,91 @@\n+library todo_app;\n+\n+import 'package:greencat/greencat.dart';\n+import 'action_type.dart';\n+import 'todo.dart';\n+import 'todo_action.dart';\n+import 'todo_state.dart';\n+import 'package:tuple/tuple.dart';\n+\n+/// The reducer for the TodoApp.\n+Reducer<TodoState, TodoAction<dynamic>> todoApp =\n+    (TodoAction<dynamic> action, {TodoState currentState}) {\n+  if (currentState == null) {\n+    return new TodoState.initial();\n+  }\n+\n+  switch (action.type) {\n+    case ActionType.setVisibilityFilter:\n+      return currentState.copy(filter: action.payload);\n+    case ActionType.addTodo:\n+    case ActionType.toggleTodo:\n+      return currentState.copy(\n+          todos: _todos(action, currentState: currentState.todos));\n+    default:\n+      return currentState;\n+  }\n+};\n+\n+/// Reducer built with the combine method in ReducerBase class.\n+ReducerBase<Tuple2<Iterable<Todo>, VisibilityFilter>, TodoAction>\n+    todoCombinedApp =\n+    new TodosReducer().combineWith(new VisibilityFilterReducer());\n+\n+Reducer<Iterable<Todo>, TodoAction<dynamic>> _todos =\n+    (TodoAction<dynamic> action, {Iterable<Todo> currentState}) {\n+  switch (action.type) {\n+    case ActionType.addTodo:\n+      return currentState = (new List<Todo>.from(currentState)\n+            ..add(new Todo(action.payload, false)))\n+          .toList(growable: false);\n+    case ActionType.toggleTodo:\n+      final originalTodo = currentState.elementAt(action.payload);\n+      final todo = originalTodo.copy(completed: !originalTodo.completed);\n+      final replaceTodo = (Todo t) => t == originalTodo ? todo : t;\n+      return currentState =\n+          currentState.map(replaceTodo).toList(growable: false);\n+    default:\n+      return currentState;\n+  }\n+};\n+\n+/// Reducer for Iterable<To do> state.\n+class TodosReducer extends ReducerBase<Iterable<Todo>, TodoAction> {\n+  @override\n+  Iterable<Todo> call(TodoAction action, {Iterable<Todo> currentState}) {\n+    if (currentState == null) {\n+      return const <Todo>[];\n+    }\n+\n+    switch (action.type) {\n+      case ActionType.addTodo:\n+        return (new List<Todo>.from(currentState)\n+              ..add(new Todo(action.payload, false)))\n+            .toList(growable: false);\n+      case ActionType.toggleTodo:\n+        final originalTodo = currentState.elementAt(action.payload);\n+        final todo = originalTodo.copy(completed: !originalTodo.completed);\n+        final replaceTodo = (Todo t) => t == originalTodo ? todo : t;\n+        return currentState.map(replaceTodo).toList(growable: false);\n+      default:\n+        return currentState;\n+    }\n+  }\n+}\n+\n+/// Reducer for VisibilityFilter state.\n+class VisibilityFilterReducer\n+    extends ReducerBase<VisibilityFilter, VisibilityFilterTodoAction> {\n+  @override\n+  VisibilityFilter call(TodoAction action, {VisibilityFilter currentState}) {\n+    if (currentState == null) {\n+      return VisibilityFilter.all;\n+    }\n+    switch (action.type) {","path":"testing/todo_list/lib/src/todo_app.dart","position":84,"original_position":84,"commit_id":"d5d54a2a3f0a64e97acd19b4358cfa4fde5bad1c","original_commit_id":"40f96c5ac6b5946ac0919d7011fe9028ec4809f8","user":{"login":"alexeieleusis","id":1234579,"avatar_url":"https://avatars.githubusercontent.com/u/1234579?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeieleusis","html_url":"https://github.com/alexeieleusis","followers_url":"https://api.github.com/users/alexeieleusis/followers","following_url":"https://api.github.com/users/alexeieleusis/following{/other_user}","gists_url":"https://api.github.com/users/alexeieleusis/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeieleusis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeieleusis/subscriptions","organizations_url":"https://api.github.com/users/alexeieleusis/orgs","repos_url":"https://api.github.com/users/alexeieleusis/repos","events_url":"https://api.github.com/users/alexeieleusis/events{/privacy}","received_events_url":"https://api.github.com/users/alexeieleusis/received_events","type":"User","site_admin":false},"body":"You're right, this is another case where I ported Redux as it was. One thing I like about this approach is that the analyzer warns about missing cases, which in this simple app already caused a bug :|","created_at":"2016-10-20T02:31:04Z","updated_at":"2016-10-20T02:31:04Z","html_url":"https://github.com/alexeieleusis/greencat/pull/1#discussion_r84204036","pull_request_url":"https://api.github.com/repos/alexeieleusis/greencat/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/alexeieleusis/greencat/pulls/comments/84204036"},"html":{"href":"https://github.com/alexeieleusis/greencat/pull/1#discussion_r84204036"},"pull_request":{"href":"https://api.github.com/repos/alexeieleusis/greencat/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/alexeieleusis/greencat/pulls/1","id":88737332,"html_url":"https://github.com/alexeieleusis/greencat/pull/1","diff_url":"https://github.com/alexeieleusis/greencat/pull/1.diff","patch_url":"https://github.com/alexeieleusis/greencat/pull/1.patch","issue_url":"https://api.github.com/repos/alexeieleusis/greencat/issues/1","number":1,"state":"open","locked":false,"title":"First alpha with examples and unit tests.","user":{"login":"alexeieleusis","id":1234579,"avatar_url":"https://avatars.githubusercontent.com/u/1234579?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeieleusis","html_url":"https://github.com/alexeieleusis","followers_url":"https://api.github.com/users/alexeieleusis/followers","following_url":"https://api.github.com/users/alexeieleusis/following{/other_user}","gists_url":"https://api.github.com/users/alexeieleusis/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeieleusis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeieleusis/subscriptions","organizations_url":"https://api.github.com/users/alexeieleusis/orgs","repos_url":"https://api.github.com/users/alexeieleusis/repos","events_url":"https://api.github.com/users/alexeieleusis/events{/privacy}","received_events_url":"https://api.github.com/users/alexeieleusis/received_events","type":"User","site_admin":false},"body":"Flutter app is stale, though should be mostly working.\r\n\r\n@jonahwilliams","created_at":"2016-10-10T21:52:04Z","updated_at":"2016-10-20T02:31:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1628e5967e65bb12f24ebce39f9fe83aa530d937","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/alexeieleusis/greencat/pulls/1/commits","review_comments_url":"https://api.github.com/repos/alexeieleusis/greencat/pulls/1/comments","review_comment_url":"https://api.github.com/repos/alexeieleusis/greencat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alexeieleusis/greencat/issues/1/comments","statuses_url":"https://api.github.com/repos/alexeieleusis/greencat/statuses/d5d54a2a3f0a64e97acd19b4358cfa4fde5bad1c","head":{"label":"alexeieleusis:combineReducersExperimentWithClasses","ref":"combineReducersExperimentWithClasses","sha":"d5d54a2a3f0a64e97acd19b4358cfa4fde5bad1c","user":{"login":"alexeieleusis","id":1234579,"avatar_url":"https://avatars.githubusercontent.com/u/1234579?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeieleusis","html_url":"https://github.com/alexeieleusis","followers_url":"https://api.github.com/users/alexeieleusis/followers","following_url":"https://api.github.com/users/alexeieleusis/following{/other_user}","gists_url":"https://api.github.com/users/alexeieleusis/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeieleusis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeieleusis/subscriptions","organizations_url":"https://api.github.com/users/alexeieleusis/orgs","repos_url":"https://api.github.com/users/alexeieleusis/repos","events_url":"https://api.github.com/users/alexeieleusis/events{/privacy}","received_events_url":"https://api.github.com/users/alexeieleusis/received_events","type":"User","site_admin":false},"repo":{"id":70531380,"name":"greencat","full_name":"alexeieleusis/greencat","owner":{"login":"alexeieleusis","id":1234579,"avatar_url":"https://avatars.githubusercontent.com/u/1234579?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeieleusis","html_url":"https://github.com/alexeieleusis","followers_url":"https://api.github.com/users/alexeieleusis/followers","following_url":"https://api.github.com/users/alexeieleusis/following{/other_user}","gists_url":"https://api.github.com/users/alexeieleusis/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeieleusis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeieleusis/subscriptions","organizations_url":"https://api.github.com/users/alexeieleusis/orgs","repos_url":"https://api.github.com/users/alexeieleusis/repos","events_url":"https://api.github.com/users/alexeieleusis/events{/privacy}","received_events_url":"https://api.github.com/users/alexeieleusis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexeieleusis/greencat","description":"A port of Redux(https://github.com/reactjs/redux) to Dart, including Redux Thunk(https://github.com/gaearon/redux-thunk) and a simple Logger.","fork":false,"url":"https://api.github.com/repos/alexeieleusis/greencat","forks_url":"https://api.github.com/repos/alexeieleusis/greencat/forks","keys_url":"https://api.github.com/repos/alexeieleusis/greencat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexeieleusis/greencat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexeieleusis/greencat/teams","hooks_url":"https://api.github.com/repos/alexeieleusis/greencat/hooks","issue_events_url":"https://api.github.com/repos/alexeieleusis/greencat/issues/events{/number}","events_url":"https://api.github.com/repos/alexeieleusis/greencat/events","assignees_url":"https://api.github.com/repos/alexeieleusis/greencat/assignees{/user}","branches_url":"https://api.github.com/repos/alexeieleusis/greencat/branches{/branch}","tags_url":"https://api.github.com/repos/alexeieleusis/greencat/tags","blobs_url":"https://api.github.com/repos/alexeieleusis/greencat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexeieleusis/greencat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexeieleusis/greencat/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexeieleusis/greencat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexeieleusis/greencat/statuses/{sha}","languages_url":"https://api.github.com/repos/alexeieleusis/greencat/languages","stargazers_url":"https://api.github.com/repos/alexeieleusis/greencat/stargazers","contributors_url":"https://api.github.com/repos/alexeieleusis/greencat/contributors","subscribers_url":"https://api.github.com/repos/alexeieleusis/greencat/subscribers","subscription_url":"https://api.github.com/repos/alexeieleusis/greencat/subscription","commits_url":"https://api.github.com/repos/alexeieleusis/greencat/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexeieleusis/greencat/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexeieleusis/greencat/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexeieleusis/greencat/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexeieleusis/greencat/contents/{+path}","compare_url":"https://api.github.com/repos/alexeieleusis/greencat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexeieleusis/greencat/merges","archive_url":"https://api.github.com/repos/alexeieleusis/greencat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexeieleusis/greencat/downloads","issues_url":"https://api.github.com/repos/alexeieleusis/greencat/issues{/number}","pulls_url":"https://api.github.com/repos/alexeieleusis/greencat/pulls{/number}","milestones_url":"https://api.github.com/repos/alexeieleusis/greencat/milestones{/number}","notifications_url":"https://api.github.com/repos/alexeieleusis/greencat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexeieleusis/greencat/labels{/name}","releases_url":"https://api.github.com/repos/alexeieleusis/greencat/releases{/id}","deployments_url":"https://api.github.com/repos/alexeieleusis/greencat/deployments","created_at":"2016-10-10T21:44:30Z","updated_at":"2016-10-11T04:43:32Z","pushed_at":"2016-10-20T02:30:01Z","git_url":"git://github.com/alexeieleusis/greencat.git","ssh_url":"git@github.com:alexeieleusis/greencat.git","clone_url":"https://github.com/alexeieleusis/greencat.git","svn_url":"https://github.com/alexeieleusis/greencat","homepage":"","size":97,"stargazers_count":1,"watchers_count":1,"language":"Dart","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"alexeieleusis:master","ref":"master","sha":"c1e34eae69ab43eaa7badb4cc3058fd33f762b54","user":{"login":"alexeieleusis","id":1234579,"avatar_url":"https://avatars.githubusercontent.com/u/1234579?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeieleusis","html_url":"https://github.com/alexeieleusis","followers_url":"https://api.github.com/users/alexeieleusis/followers","following_url":"https://api.github.com/users/alexeieleusis/following{/other_user}","gists_url":"https://api.github.com/users/alexeieleusis/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeieleusis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeieleusis/subscriptions","organizations_url":"https://api.github.com/users/alexeieleusis/orgs","repos_url":"https://api.github.com/users/alexeieleusis/repos","events_url":"https://api.github.com/users/alexeieleusis/events{/privacy}","received_events_url":"https://api.github.com/users/alexeieleusis/received_events","type":"User","site_admin":false},"repo":{"id":70531380,"name":"greencat","full_name":"alexeieleusis/greencat","owner":{"login":"alexeieleusis","id":1234579,"avatar_url":"https://avatars.githubusercontent.com/u/1234579?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeieleusis","html_url":"https://github.com/alexeieleusis","followers_url":"https://api.github.com/users/alexeieleusis/followers","following_url":"https://api.github.com/users/alexeieleusis/following{/other_user}","gists_url":"https://api.github.com/users/alexeieleusis/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeieleusis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeieleusis/subscriptions","organizations_url":"https://api.github.com/users/alexeieleusis/orgs","repos_url":"https://api.github.com/users/alexeieleusis/repos","events_url":"https://api.github.com/users/alexeieleusis/events{/privacy}","received_events_url":"https://api.github.com/users/alexeieleusis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexeieleusis/greencat","description":"A port of Redux(https://github.com/reactjs/redux) to Dart, including Redux Thunk(https://github.com/gaearon/redux-thunk) and a simple Logger.","fork":false,"url":"https://api.github.com/repos/alexeieleusis/greencat","forks_url":"https://api.github.com/repos/alexeieleusis/greencat/forks","keys_url":"https://api.github.com/repos/alexeieleusis/greencat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexeieleusis/greencat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexeieleusis/greencat/teams","hooks_url":"https://api.github.com/repos/alexeieleusis/greencat/hooks","issue_events_url":"https://api.github.com/repos/alexeieleusis/greencat/issues/events{/number}","events_url":"https://api.github.com/repos/alexeieleusis/greencat/events","assignees_url":"https://api.github.com/repos/alexeieleusis/greencat/assignees{/user}","branches_url":"https://api.github.com/repos/alexeieleusis/greencat/branches{/branch}","tags_url":"https://api.github.com/repos/alexeieleusis/greencat/tags","blobs_url":"https://api.github.com/repos/alexeieleusis/greencat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexeieleusis/greencat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexeieleusis/greencat/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexeieleusis/greencat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexeieleusis/greencat/statuses/{sha}","languages_url":"https://api.github.com/repos/alexeieleusis/greencat/languages","stargazers_url":"https://api.github.com/repos/alexeieleusis/greencat/stargazers","contributors_url":"https://api.github.com/repos/alexeieleusis/greencat/contributors","subscribers_url":"https://api.github.com/repos/alexeieleusis/greencat/subscribers","subscription_url":"https://api.github.com/repos/alexeieleusis/greencat/subscription","commits_url":"https://api.github.com/repos/alexeieleusis/greencat/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexeieleusis/greencat/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexeieleusis/greencat/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexeieleusis/greencat/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexeieleusis/greencat/contents/{+path}","compare_url":"https://api.github.com/repos/alexeieleusis/greencat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexeieleusis/greencat/merges","archive_url":"https://api.github.com/repos/alexeieleusis/greencat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexeieleusis/greencat/downloads","issues_url":"https://api.github.com/repos/alexeieleusis/greencat/issues{/number}","pulls_url":"https://api.github.com/repos/alexeieleusis/greencat/pulls{/number}","milestones_url":"https://api.github.com/repos/alexeieleusis/greencat/milestones{/number}","notifications_url":"https://api.github.com/repos/alexeieleusis/greencat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexeieleusis/greencat/labels{/name}","releases_url":"https://api.github.com/repos/alexeieleusis/greencat/releases{/id}","deployments_url":"https://api.github.com/repos/alexeieleusis/greencat/deployments","created_at":"2016-10-10T21:44:30Z","updated_at":"2016-10-11T04:43:32Z","pushed_at":"2016-10-20T02:30:01Z","git_url":"git://github.com/alexeieleusis/greencat.git","ssh_url":"git@github.com:alexeieleusis/greencat.git","clone_url":"https://github.com/alexeieleusis/greencat.git","svn_url":"https://github.com/alexeieleusis/greencat","homepage":"","size":97,"stargazers_count":1,"watchers_count":1,"language":"Dart","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alexeieleusis/greencat/pulls/1"},"html":{"href":"https://github.com/alexeieleusis/greencat/pull/1"},"issue":{"href":"https://api.github.com/repos/alexeieleusis/greencat/issues/1"},"comments":{"href":"https://api.github.com/repos/alexeieleusis/greencat/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/alexeieleusis/greencat/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/alexeieleusis/greencat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alexeieleusis/greencat/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/alexeieleusis/greencat/statuses/d5d54a2a3f0a64e97acd19b4358cfa4fde5bad1c"}}}}
{"actor":{"display_login":"alexeieleusis"}}