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

Unified Diff: samples/simple_todo/todo_model.dart

Issue 2035023003: Remove service-compiler related code. (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/simple_todo/simple_todo_service_tests.dart ('k') | samples/todomvc/android/TodoMVC/.gitignore » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/simple_todo/todo_model.dart
diff --git a/samples/simple_todo/todo_model.dart b/samples/simple_todo/todo_model.dart
deleted file mode 100644
index 1f3cbaa5981766e40b00797081f6cbbd5bf3b7fe..0000000000000000000000000000000000000000
--- a/samples/simple_todo/todo_model.dart
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE.md file.
-
-library todomvc.todo_model;
-
-// Very simple model for a collection of TODO items.
-
-class Item {
- String title;
- bool _done = false;
- int _id;
-
- static int id_pool = 0;
-
- Item(this.title) {
- _id = id_pool++;
- }
-
- bool get done => _done;
- void complete() { _done = true; }
- void uncomplete() { _done = false; }
- int get id => _id;
-}
-
-class TodoModel {
- Map<int, Item> todos;
-
- TodoModel() : todos = new Map<int, Item>();
-
- void createItem(String title) {
- assert(title.isNotEmpty);
- Item item = new Item(title);
- todos.putIfAbsent( item.id, () => item );
- }
-
- void deleteItem(int id) {
- if (todos.containsKey(id)) {
- todos.remove(id);
- }
- }
-
- void completeItem(int id) {
- if (todos.containsKey(id)) {
- todos[id].complete();
- }
- }
-
- void uncompleteItem(int id) {
- if (todos.containsKey(id)) {
- todos[id].uncomplete();
- }
- }
-
- void clearItems() {
- List<int> toDelete = new List<int>();
-
- todos.forEach((k,v) {
- if (v.done) {
- toDelete.add(k);
- }
- });
-
- toDelete.forEach((key) {
- todos.remove(key);
- });
- }
-
-}
« no previous file with comments | « samples/simple_todo/simple_todo_service_tests.dart ('k') | samples/todomvc/android/TodoMVC/.gitignore » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698