OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
4 for details. All rights reserved. Use of this source code is governed by a | 4 for details. All rights reserved. Use of this source code is governed by a |
5 BSD-style license that can be found in the LICENSE file. | 5 BSD-style license that can be found in the LICENSE file. |
6 --> | 6 --> |
7 <html lang="en"> | 7 <html lang="en"> |
8 <head> | 8 <head> |
9 <meta charset="utf-8"> | 9 <meta charset="utf-8"> |
10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
(...skipping 24 matching lines...) Expand all Loading... | |
35 'Currant', 'Cherry', 'Clementine', 'Date', 'Durian', 'Fig', | 35 'Currant', 'Cherry', 'Clementine', 'Date', 'Durian', 'Fig', |
36 'Gooseberry', 'Grape', 'Grapefruit', 'Guava', 'Huckleberry', | 36 'Gooseberry', 'Grape', 'Grapefruit', 'Guava', 'Huckleberry', |
37 'Kiwi', 'Lemon', 'Lime', 'Lychee', 'Mandarin', 'Mango', | 37 'Kiwi', 'Lemon', 'Lime', 'Lychee', 'Mandarin', 'Mango', |
38 'Cantaloupe', 'Honeydew melon', 'Nectarine', 'Orange', | 38 'Cantaloupe', 'Honeydew melon', 'Nectarine', 'Orange', |
39 'Peach', 'Pear', 'Plum', 'Pineapple', 'Pomegranate', | 39 'Peach', 'Pear', 'Plum', 'Pineapple', 'Pomegranate', |
40 'Raspberry', 'Redcurrant', 'Star fruit', 'Strawberry', | 40 'Raspberry', 'Redcurrant', 'Star fruit', 'Strawberry', |
41 'Tangerine', 'Tomato', 'Watermelon']; | 41 'Tangerine', 'Tomato', 'Watermelon']; |
42 | 42 |
43 List<String> get results { | 43 List<String> get results { |
44 var res = fruits.filter( | 44 var res = fruits.filter( |
45 (v) => v.toLowerCase().contains(query.toLowerCase())); | 45 (v) => v.toLowerCase().contains(query.toLowerCase())) as List<String>; |
Jennifer Messerly
2012/12/07 20:31:57
nit: put type annotation on LHS :)
List<String> r
Siggi Cherem (dart-lang)
2012/12/18 03:10:00
:)... good point.
| |
46 if (res.length > 20) { | 46 if (res.length > 20) { |
47 res.length = 20; | 47 res.length = 20; |
48 res.add('... and many more'); | 48 res.add('... and many more'); |
49 } | 49 } |
50 return res; | 50 return res; |
51 } | 51 } |
52 | 52 |
53 bool get noMatches => results.isEmpty; | 53 bool get noMatches => results.isEmpty; |
54 | 54 |
55 main() {} | 55 main() {} |
56 </script> | 56 </script> |
57 </body> | 57 </body> |
58 </html> | 58 </html> |
OLD | NEW |