| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 library pop_pop_win.platform_chrome_app; | |
| 5 | |
| 6 import 'dart:async'; | |
| 7 | |
| 8 import 'package:pop_pop_win/platform_target.dart'; | |
| 9 import 'package:chrome/gen/storage.dart'; | |
| 10 | |
| 11 class PlatformChromeApp extends PlatformTarget { | |
| 12 final StreamController _aboutController = new StreamController(sync: true); | |
| 13 bool _about = false; | |
| 14 | |
| 15 int get size => 7; | |
| 16 | |
| 17 PlatformChromeApp(): super.base(); | |
| 18 | |
| 19 Future clearValues() => storage.local.clear(); | |
| 20 | |
| 21 Future setValue(String key, String value) => storage.local.set({key : value}); | |
| 22 | |
| 23 Future<String> getValue(String key) => storage.local.get(key) | |
| 24 .then((Map<String, String> values) => values[key]); | |
| 25 | |
| 26 bool get showAbout => _about; | |
| 27 | |
| 28 Stream get aboutChanged => _aboutController.stream; | |
| 29 | |
| 30 void toggleAbout([bool value]) { | |
| 31 assert(_about != null); | |
| 32 if (value == null) { | |
| 33 value = !_about; | |
| 34 } | |
| 35 _about = value; | |
| 36 _aboutController.add(null); | |
| 37 } | |
| 38 } | |
| OLD | NEW |