| OLD | NEW |
| 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 part of dart.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A sequence of characters. | 8 * A sequence of characters. |
| 9 * | 9 * |
| 10 * A string can be either single or multiline. Single line strings are | 10 * A string can be either single or multiline. Single line strings are |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 * [defaultValue]. | 136 * [defaultValue]. |
| 137 * | 137 * |
| 138 * Example of getting a value: | 138 * Example of getting a value: |
| 139 * | 139 * |
| 140 * const String.fromEnvironment("defaultFloo", defaultValue: "no floo") | 140 * const String.fromEnvironment("defaultFloo", defaultValue: "no floo") |
| 141 * | 141 * |
| 142 * Example of checking whether a declaration is there at all: | 142 * Example of checking whether a declaration is there at all: |
| 143 * | 143 * |
| 144 * var isDeclared = const String.fromEnvironment("maybeDeclared") != null; | 144 * var isDeclared = const String.fromEnvironment("maybeDeclared") != null; |
| 145 */ | 145 */ |
| 146 // The .fromEnvironment() constructors are special in that we do not want |
| 147 // users to call them using "new". We prohibit that by giving them bodies |
| 148 // that throw, even though const constructors are not allowed to have bodies. |
| 149 // Disable those static errors. |
| 150 //ignore: const_constructor_with_body |
| 151 //ignore: const_factory |
| 146 external const factory String.fromEnvironment(String name, | 152 external const factory String.fromEnvironment(String name, |
| 147 {String defaultValue}); | 153 {String defaultValue}); |
| 148 | 154 |
| 149 /** | 155 /** |
| 150 * Gets the character (as a single-code-unit [String]) at the given [index]. | 156 * Gets the character (as a single-code-unit [String]) at the given [index]. |
| 151 * | 157 * |
| 152 * The returned string represents exactly one UTF-16 code unit, which may be | 158 * The returned string represents exactly one UTF-16 code unit, which may be |
| 153 * half of a surrogate pair. A single member of a surrogate pair is an | 159 * half of a surrogate pair. A single member of a surrogate pair is an |
| 154 * invalid UTF-16 string: | 160 * invalid UTF-16 string: |
| 155 * | 161 * |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 _position = position - 1; | 795 _position = position - 1; |
| 790 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); | 796 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); |
| 791 return true; | 797 return true; |
| 792 } | 798 } |
| 793 } | 799 } |
| 794 _position = position; | 800 _position = position; |
| 795 _currentCodePoint = codeUnit; | 801 _currentCodePoint = codeUnit; |
| 796 return true; | 802 return true; |
| 797 } | 803 } |
| 798 } | 804 } |
| OLD | NEW |