mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 05:26:57 +00:00
cc736dfb65
This reapplies commit0c05e33836
and reverts the revert029e0cec71
. Tested: Added few new tests, updated existing. Mainly regression testing. CoreLibraryReviewExempt: Reviewed in original CL. Change-Id: Ifcc79ce2f9375f607722643a04957b0961e6c295 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284304 Reviewed-by: Ömer Ağacan <omersa@google.com> Commit-Queue: Lasse Nielsen <lrn@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
34 lines
1.1 KiB
Dart
34 lines
1.1 KiB
Dart
// Copyright (c) 2013, the Dart 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 file.
|
|
|
|
part of dart.core;
|
|
|
|
/// The reserved word `null` denotes an object that is the sole instance of
|
|
/// this class.
|
|
///
|
|
/// The `Null` class is the only class which does not implement `Object`.
|
|
/// It is a compile-time error for a class to attempt to extend or implement
|
|
/// [Null].
|
|
///
|
|
/// The language contains a number of specialized operators for working with
|
|
/// `null` value. Examples:
|
|
/// ```dart
|
|
/// e1! // Throws if e1 is null.
|
|
/// e2 ?? e3 // Same as e2, unless e2 is null, then use value of e3
|
|
/// x ??= e4 // Same as x unless x is null, then same as `x = e4`.
|
|
/// e5?.foo() // call `foo` on e5, unless e5 is null.
|
|
/// [...? e6] // spreads e6 into the list literal, unless e6 is null.
|
|
/// ```
|
|
@pragma("vm:entry-point")
|
|
final class Null {
|
|
factory Null._uninstantiable() {
|
|
throw UnsupportedError('class Null cannot be instantiated');
|
|
}
|
|
|
|
external int get hashCode;
|
|
|
|
/// Returns the string `"null"`.
|
|
String toString() => "null";
|
|
}
|