Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: samples/third_party/todomvc/web/model.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library model; 5 library model;
6 6
7 class ViewModel { 7 class ViewModel {
8 bool isVisible(Todo todo) => todo != null && 8 bool isVisible(Todo todo) => todo != null &&
9 ((showIncomplete && !todo.done) || (showDone && todo.done)); 9 ((showIncomplete && !todo.done) || (showDone && todo.done));
10 10
(...skipping 23 matching lines...) Expand all
34 34
35 int get doneCount { 35 int get doneCount {
36 int res = 0; 36 int res = 0;
37 todos.forEach((t) { if (t.done) res++; }); 37 todos.forEach((t) { if (t.done) res++; });
38 return res; 38 return res;
39 } 39 }
40 40
41 int get remaining => todos.length - doneCount; 41 int get remaining => todos.length - doneCount;
42 42
43 void clearDone() { 43 void clearDone() {
44 todos = todos.filter((t) => !t.done); 44 todos = todos.where((t) => !t.done).toList();
45 } 45 }
46 } 46 }
47 47
48 final AppModel app = new AppModel(); 48 final AppModel app = new AppModel();
49 49
50 class Todo { 50 class Todo {
51 String task; 51 String task;
52 bool done = false; 52 bool done = false;
53 53
54 Todo(this.task); 54 Todo(this.task);
55 55
56 String toString() => "$task ${done ? '(done)' : '(not done)'}"; 56 String toString() => "$task ${done ? '(done)' : '(not done)'}";
57 } 57 }
OLDNEW
« no previous file with comments | « samples/third_party/dromaeo/tests/dom-modify-htmlidiomatic.dart ('k') | sdk/lib/_internal/compiler/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698