OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015, 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 | |
5 library engine.utilities.asserts; | |
6 | |
7 /** | |
8 * Ensures that the given [value] is not null. | |
9 * Otherwise throws an [ArgumentError]. | |
10 * An optional [description] is used in the error message. | |
11 */ | |
12 void notNull(Object value, [String description]) { | |
13 if (value == null) { | |
14 if (description == null) { | |
15 throw new ArgumentError('Must not be null'); | |
16 } else { | |
17 throw new ArgumentError('Must not be null: $description'); | |
18 } | |
19 } | |
20 } | |
OLD | NEW |