Appearance
CanvasRenderingContext2D ​
class CanvasRenderingContext2D extends JavaScriptObject implements CanvasRenderingContextAnnotations: @Native.new("CanvasRenderingContext2D")
Implemented types
Properties ​
deprecated backingStorePixelRatio no setter ​
double get backingStorePixelRatioDEPRECATED
Deprecated always returns 1.0
Implementation
dart
@deprecated
double get backingStorePixelRatio => 1.0;canvas no setter override ​
CanvasElement get canvasImplementation
dart
CanvasElement get canvas native;currentTransform read / write ​
Matrix? get currentTransformImplementation
dart
Matrix? get currentTransform native;
set currentTransform(Matrix? value) native;direction read / write ​
String? get directionImplementation
dart
String? get direction native;
set direction(String? value) native;fillStyle read / write ​
Object? get fillStyleImplementation
dart
@Creates('String|CanvasGradient|CanvasPattern')
@Returns('String|CanvasGradient|CanvasPattern')
Object? get fillStyle native;
set fillStyle(Object? value) native;filter read / write ​
String? get filterImplementation
dart
String? get filter native;
set filter(String? value) native;font read / write ​
String get fontImplementation
dart
String get font native;
set font(String value) native;globalAlpha read / write ​
num get globalAlphaImplementation
dart
num get globalAlpha native;
set globalAlpha(num value) native;globalCompositeOperation read / write ​
String get globalCompositeOperationImplementation
dart
String get globalCompositeOperation native;
set globalCompositeOperation(String value) native;hashCode no setter inherited ​
int get hashCodeInherited from Interceptor.
Implementation
dart
int get hashCode => Primitives.objectHashCode(this);imageSmoothingEnabled read / write ​
bool? get imageSmoothingEnabledWhether images and patterns on this canvas will be smoothed when this canvas is scaled.
Other resources ​
- Image smoothing from WHATWG.
Implementation
dart
bool? get imageSmoothingEnabled native;
set imageSmoothingEnabled(bool? value) native;imageSmoothingQuality read / write ​
String? get imageSmoothingQualityImplementation
dart
String? get imageSmoothingQuality native;
set imageSmoothingQuality(String? value) native;lineCap read / write ​
String get lineCapImplementation
dart
String get lineCap native;
set lineCap(String value) native;lineDashOffset read / write ​
num get lineDashOffsetImplementation
dart
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@SupportedBrowser(SupportedBrowser.IE, '11')
@Unstable()
// TODO(14316): Firefox has this functionality with mozDashOffset, but it
// needs to be polyfilled.
num get lineDashOffset =>
JS('num', '#.lineDashOffset || #.webkitLineDashOffset', this, this);
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@SupportedBrowser(SupportedBrowser.IE, '11')
@Unstable()
// TODO(14316): Firefox has this functionality with mozDashOffset, but it
// needs to be polyfilled.
set lineDashOffset(num value) {
JS(
'void',
'typeof #.lineDashOffset != "undefined" ? #.lineDashOffset = # : '
'#.webkitLineDashOffset = #',
this,
this,
value,
this,
value,
);
}lineJoin read / write ​
String get lineJoinImplementation
dart
String get lineJoin native;
set lineJoin(String value) native;lineWidth read / write ​
num get lineWidthImplementation
dart
num get lineWidth native;
set lineWidth(num value) native;miterLimit read / write ​
num get miterLimitImplementation
dart
num get miterLimit native;
set miterLimit(num value) native;runtimeType no setter inherited ​
Type get runtimeTypeInherited from Interceptor.
Implementation
dart
Type get runtimeType =>
getRuntimeTypeOfInterceptorNotArray(getInterceptor(this), this);shadowBlur read / write ​
num get shadowBlurImplementation
dart
num get shadowBlur native;
set shadowBlur(num value) native;shadowColor read / write ​
String get shadowColorImplementation
dart
String get shadowColor native;
set shadowColor(String value) native;shadowOffsetX read / write ​
num get shadowOffsetXImplementation
dart
num get shadowOffsetX native;
set shadowOffsetX(num value) native;shadowOffsetY read / write ​
num get shadowOffsetYImplementation
dart
num get shadowOffsetY native;
set shadowOffsetY(num value) native;strokeStyle read / write ​
Object? get strokeStyleImplementation
dart
@Creates('String|CanvasGradient|CanvasPattern')
@Returns('String|CanvasGradient|CanvasPattern')
Object? get strokeStyle native;
set strokeStyle(Object? value) native;textAlign read / write ​
String get textAlignImplementation
dart
String get textAlign native;
set textAlign(String value) native;textBaseline read / write ​
String get textBaselineImplementation
dart
String get textBaseline native;
set textBaseline(String value) native;Methods ​
addHitRegion() ​
void addHitRegion([Map<dynamic, dynamic>? options])Implementation
dart
void addHitRegion([Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
_addHitRegion_1(options_1);
return;
}
_addHitRegion_2();
return;
}arc() ​
Implementation
dart
void arc(
num x,
num y,
num radius,
num startAngle,
num endAngle, [
bool anticlockwise = false,
]) {
// TODO(terry): This should not be needed: dartbug.com/20939.
JS(
'void',
'#.arc(#, #, #, #, #, #)',
this,
x,
y,
radius,
startAngle,
endAngle,
anticlockwise,
);
}arcTo() ​
Implementation
dart
void arcTo(num x1, num y1, num x2, num y2, num radius) native;beginPath() ​
void beginPath()Implementation
dart
void beginPath() native;bezierCurveTo() ​
Implementation
dart
void bezierCurveTo(
num cp1x,
num cp1y,
num cp2x,
num cp2y,
num x,
num y,
) native;clearHitRegions() ​
void clearHitRegions()Implementation
dart
void clearHitRegions() native;clearRect() ​
Implementation
dart
void clearRect(num x, num y, num width, num height) native;clip() ​
void clip([dynamic path_OR_winding, String? winding])Implementation
dart
void clip([path_OR_winding, String? winding]) native;closePath() ​
void closePath()Implementation
dart
void closePath() native;createImageData() ​
ImageData createImageData(
dynamic data_OR_imagedata_OR_sw, [
int? sh_OR_sw,
dynamic imageDataColorSettings_OR_sh,
Map<dynamic, dynamic>? imageDataColorSettings,
])Implementation
dart
@Creates('ImageData|=Object')
ImageData createImageData(
data_OR_imagedata_OR_sw, [
int? sh_OR_sw,
imageDataColorSettings_OR_sh,
Map? imageDataColorSettings,
]) {
if ((data_OR_imagedata_OR_sw is ImageData) &&
sh_OR_sw == null &&
imageDataColorSettings_OR_sh == null &&
imageDataColorSettings == null) {
var imagedata_1 = convertDartToNative_ImageData(data_OR_imagedata_OR_sw);
return convertNativeToDart_ImageData(_createImageData_1(imagedata_1));
}
if (sh_OR_sw != null &&
(data_OR_imagedata_OR_sw is int) &&
imageDataColorSettings_OR_sh == null &&
imageDataColorSettings == null) {
return convertNativeToDart_ImageData(
_createImageData_2(data_OR_imagedata_OR_sw, sh_OR_sw),
);
}
if ((imageDataColorSettings_OR_sh is Map) &&
sh_OR_sw != null &&
(data_OR_imagedata_OR_sw is int) &&
imageDataColorSettings == null) {
var imageDataColorSettings_1 = convertDartToNative_Dictionary(
imageDataColorSettings_OR_sh,
);
return convertNativeToDart_ImageData(
_createImageData_3(
data_OR_imagedata_OR_sw,
sh_OR_sw,
imageDataColorSettings_1,
),
);
}
if ((imageDataColorSettings_OR_sh is int) &&
sh_OR_sw != null &&
data_OR_imagedata_OR_sw != null &&
imageDataColorSettings == null) {
return convertNativeToDart_ImageData(
_createImageData_4(
data_OR_imagedata_OR_sw,
sh_OR_sw,
imageDataColorSettings_OR_sh,
),
);
}
if (imageDataColorSettings != null &&
(imageDataColorSettings_OR_sh is int) &&
sh_OR_sw != null &&
data_OR_imagedata_OR_sw != null) {
var imageDataColorSettings_1 = convertDartToNative_Dictionary(
imageDataColorSettings,
);
return convertNativeToDart_ImageData(
_createImageData_5(
data_OR_imagedata_OR_sw,
sh_OR_sw,
imageDataColorSettings_OR_sh,
imageDataColorSettings_1,
),
);
}
throw new ArgumentError("Incorrect number or type of arguments");
}createImageDataFromImageData() ​
Implementation
dart
ImageData createImageDataFromImageData(ImageData imagedata) =>
JS('ImageData', '#.createImageData(#)', this, imagedata);createLinearGradient() ​
CanvasGradient createLinearGradient(num x0, num y0, num x1, num y1)Implementation
dart
CanvasGradient createLinearGradient(num x0, num y0, num x1, num y1) native;createPattern() ​
CanvasPattern? createPattern(Object image, String repetitionType)Implementation
dart
CanvasPattern? createPattern(Object image, String repetitionType) native;createPatternFromImage() ​
CanvasPattern createPatternFromImage(ImageElement image, String repetitionType)Implementation
dart
CanvasPattern createPatternFromImage(
ImageElement image,
String repetitionType,
) =>
JS('CanvasPattern', '#.createPattern(#, #)', this, image, repetitionType);createRadialGradient() ​
Implementation
dart
CanvasGradient createRadialGradient(
num x0,
num y0,
num r0,
num x1,
num y1,
num r1,
) native;drawFocusIfNeeded() ​
void drawFocusIfNeeded(dynamic element_OR_path, [Element? element])Implementation
dart
void drawFocusIfNeeded(element_OR_path, [Element? element]) native;drawImage() ​
void drawImage(CanvasImageSource source, num destX, num destY)Draws an image from a CanvasImageSource to this canvas.
The entire image from source will be drawn to this context with its top left corner at the point (destX, destY). If the image is larger than canvas will allow, the image will be clipped to fit the available space.
dart
CanvasElement canvas = new CanvasElement(width: 600, height: 600);
CanvasRenderingContext2D ctx = canvas.context2D;
ImageElement img = document.query('img');
ctx.drawImage(img, 100, 100);
VideoElement video = document.query('video');
ctx.drawImage(video, 0, 0);
CanvasElement otherCanvas = document.query('canvas');
otherCanvas.width = 100;
otherCanvas.height = 100;
ctx.drawImage(otherCanvas, 590, 590); // will get clippedSee also:
- CanvasImageSource for more information on what data is retrieved from
source. - drawImage from the WHATWG.
Implementation
dart
@JSName('drawImage')
void drawImage(CanvasImageSource source, num destX, num destY) native;drawImageScaled() ​
void drawImageScaled(
CanvasImageSource source,
num destX,
num destY,
num destWidth,
num destHeight,
)Draws an image from a CanvasImageSource to an area of this canvas.
The image will be drawn to this context with its top left corner at the point (destX, destY) and will be scaled to be destWidth wide and destHeight tall.
If the image is larger than canvas will allow, the image will be clipped to fit the available space.
dart
CanvasElement canvas = new CanvasElement(width: 600, height: 600);
CanvasRenderingContext2D ctx = canvas.context2D;
ImageElement img = document.query('img');
img.width = 100;
img.height = 100;
// Scale the image to 300x50 at the point (20, 20)
ctx.drawImageScaled(img, 20, 20, 300, 50);See also:
- CanvasImageSource for more information on what data is retrieved from
source. - drawImage from the WHATWG.
Implementation
dart
@JSName('drawImage')
void drawImageScaled(
CanvasImageSource source,
num destX,
num destY,
num destWidth,
num destHeight,
) native;drawImageScaledFromSource() ​
void drawImageScaledFromSource(
CanvasImageSource source,
num sourceX,
num sourceY,
num sourceWidth,
num sourceHeight,
num destX,
num destY,
num destWidth,
num destHeight,
)Draws an image from a CanvasImageSource to an area of this canvas.
The image is a region of source that is sourceWidth wide and sourceHeight tall with top left corner at (sourceX, sourceY). The image will be drawn to this context with its top left corner at the point (destX, destY) and will be scaled to be destWidth wide and destHeight tall.
If the image is larger than canvas will allow, the image will be clipped to fit the available space.
dart
VideoElement video = document.query('video');
video.width = 100;
video.height = 100;
// Take the middle 20x20 pixels from the video and stretch them.
ctx.drawImageScaledFromSource(video, 40, 40, 20, 20, 50, 50, 100, 100);
// Draw the top 100x20 pixels from the otherCanvas to this one.
CanvasElement otherCanvas = document.query('canvas');
ctx.drawImageScaledFromSource(otherCanvas, 0, 0, 100, 20, 0, 0, 100, 20);See also:
- CanvasImageSource for more information on what data is retrieved from
source. - drawImage from the WHATWG.
Implementation
dart
@JSName('drawImage')
void drawImageScaledFromSource(
CanvasImageSource source,
num sourceX,
num sourceY,
num sourceWidth,
num sourceHeight,
num destX,
num destY,
num destWidth,
num destHeight,
) native;drawImageToRect() ​
void drawImageToRect(
CanvasImageSource source,
Rectangle<num> destRect, {
Rectangle<num>? sourceRect,
})Draws an image from a CanvasImageSource to an area of this canvas.
The image will be drawn to an area of this canvas defined by destRect. sourceRect defines the region of the source image that is drawn. If sourceRect is not provided, then the entire rectangular image from source will be drawn to this context.
If the image is larger than canvas will allow, the image will be clipped to fit the available space.
dart
CanvasElement canvas = new CanvasElement(width: 600, height: 600);
CanvasRenderingContext2D ctx = canvas.context2D;
ImageElement img = document.query('img');
img.width = 100;
img.height = 100;
// Scale the image to 20x20.
ctx.drawImageToRect(img, new Rectangle(50, 50, 20, 20));
VideoElement video = document.query('video');
video.width = 100;
video.height = 100;
// Take the middle 20x20 pixels from the video and stretch them.
ctx.drawImageToRect(video, new Rectangle(50, 50, 100, 100),
sourceRect: new Rectangle(40, 40, 20, 20));
// Draw the top 100x20 pixels from the otherCanvas.
CanvasElement otherCanvas = document.query('canvas');
ctx.drawImageToRect(otherCanvas, new Rectangle(0, 0, 100, 20),
sourceRect: new Rectangle(0, 0, 100, 20));See also:
- CanvasImageSource for more information on what data is retrieved from
source. - drawImage from the WHATWG.
Implementation
dart
void drawImageToRect(
CanvasImageSource source,
Rectangle destRect, {
Rectangle? sourceRect,
}) {
if (sourceRect == null) {
drawImageScaled(
source,
destRect.left,
destRect.top,
destRect.width,
destRect.height,
);
} else {
drawImageScaledFromSource(
source,
sourceRect.left,
sourceRect.top,
sourceRect.width,
sourceRect.height,
destRect.left,
destRect.top,
destRect.width,
destRect.height,
);
}
}ellipse() ​
void ellipse(
num x,
num y,
num radiusX,
num radiusY,
num rotation,
num startAngle,
num endAngle,
bool? anticlockwise,
)Implementation
dart
void ellipse(
num x,
num y,
num radiusX,
num radiusY,
num rotation,
num startAngle,
num endAngle,
bool? anticlockwise,
) native;fill() ​
void fill([dynamic path_OR_winding, String? winding])Implementation
dart
void fill([path_OR_winding, String? winding]) native;fillRect() ​
Implementation
dart
void fillRect(num x, num y, num width, num height) native;fillText() ​
Draws text to the canvas.
The text is drawn starting at coordinates (x, y). If maxWidth is provided and the text is computed to be wider than maxWidth, then the drawn text is scaled down horizontally to fit.
The text uses the current CanvasRenderingContext2D.font property for font options, such as typeface and size, and the current CanvasRenderingContext2D.fillStyle for style options such as color. The current CanvasRenderingContext2D.textAlign and CanvasRenderingContext2D.textBaseline properties are also applied to the drawn text.
Implementation
dart
void fillText(String text, num x, num y, [num? maxWidth]) {
if (maxWidth != null) {
JS('void', '#.fillText(#, #, #, #)', this, text, x, y, maxWidth);
} else {
JS('void', '#.fillText(#, #, #)', this, text, x, y);
}
}getContextAttributes() ​
Map<dynamic, dynamic> getContextAttributes()Implementation
dart
Map getContextAttributes() {
return convertNativeToDart_Dictionary(_getContextAttributes_1())!;
}getImageData() ​
Implementation
dart
@Creates('ImageData|=Object')
ImageData getImageData(int sx, int sy, int sw, int sh) {
return convertNativeToDart_ImageData(_getImageData_1(sx, sy, sw, sh));
}getLineDash() ​
Implementation
dart
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@SupportedBrowser(SupportedBrowser.IE, '11')
@Unstable()
List<num> getLineDash() {
// TODO(14316): Firefox has this functionality with mozDash, but it's a bit
// different.
if (JS('bool', '!!#.getLineDash', this)) {
return JS('List<num>', '#.getLineDash()', this);
} else if (JS('bool', '!!#.webkitLineDash', this)) {
return JS('List<num>', '#.webkitLineDash', this);
}
return [];
}isContextLost() ​
bool isContextLost()Implementation
dart
bool isContextLost() native;isPointInPath() ​
Implementation
dart
bool isPointInPath(
path_OR_x,
num x_OR_y, [
winding_OR_y,
String? winding,
]) native;isPointInStroke() ​
Implementation
dart
bool isPointInStroke(path_OR_x, num x_OR_y, [num? y]) native;lineTo() ​
Implementation
dart
void lineTo(num x, num y) native;measureText() ​
TextMetrics measureText(String text)Implementation
dart
TextMetrics measureText(String text) native;moveTo() ​
Implementation
dart
void moveTo(num x, num y) native;noSuchMethod() inherited ​
dynamic noSuchMethod(Invocation invocation)Invoked when a nonexistent method or property is accessed.
A dynamic member invocation can attempt to call a member which doesn't exist on the receiving object. Example:
dart
dynamic object = 1;
object.add(42); // Statically allowed, run-time errorThis invalid code will invoke the noSuchMethod method of the integer 1 with an Invocation representing the .add(42) call and arguments (which then throws).
Classes can override noSuchMethod to provide custom behavior for such invalid dynamic invocations.
A class with a non-default noSuchMethod invocation can also omit implementations for members of its interface. Example:
dart
class MockList<T> implements List<T> {
noSuchMethod(Invocation invocation) {
log(invocation);
super.noSuchMethod(invocation); // Will throw.
}
}
void main() {
MockList().add(42);
}This code has no compile-time warnings or errors even though the MockList class has no concrete implementation of any of the List interface methods. Calls to List methods are forwarded to noSuchMethod, so this code will log an invocation similar to Invocation.method(#add, [42]) and then throw.
If a value is returned from noSuchMethod, it becomes the result of the original invocation. If the value is not of a type that can be returned by the original invocation, a type error occurs at the invocation.
The default behavior is to throw a NoSuchMethodError.
Inherited from Interceptor.
Implementation
dart
dynamic noSuchMethod(Invocation invocation) {
throw NoSuchMethodError.withInvocation(this, invocation);
}putImageData() ​
void putImageData(
ImageData imagedata,
int dx,
int dy, [
int? dirtyX,
int? dirtyY,
int? dirtyWidth,
int? dirtyHeight,
])Implementation
dart
void putImageData(
ImageData imagedata,
int dx,
int dy, [
int? dirtyX,
int? dirtyY,
int? dirtyWidth,
int? dirtyHeight,
]) {
if (dirtyX == null &&
dirtyY == null &&
dirtyWidth == null &&
dirtyHeight == null) {
var imagedata_1 = convertDartToNative_ImageData(imagedata);
_putImageData_1(imagedata_1, dx, dy);
return;
}
if (dirtyHeight != null &&
dirtyWidth != null &&
dirtyY != null &&
dirtyX != null) {
var imagedata_1 = convertDartToNative_ImageData(imagedata);
_putImageData_2(
imagedata_1,
dx,
dy,
dirtyX,
dirtyY,
dirtyWidth,
dirtyHeight,
);
return;
}
throw new ArgumentError("Incorrect number or type of arguments");
}quadraticCurveTo() ​
Implementation
dart
void quadraticCurveTo(num cpx, num cpy, num x, num y) native;rect() ​
Implementation
dart
void rect(num x, num y, num width, num height) native;removeHitRegion() ​
void removeHitRegion(String id)Implementation
dart
void removeHitRegion(String id) native;resetTransform() ​
void resetTransform()Implementation
dart
void resetTransform() native;restore() ​
void restore()Implementation
dart
void restore() native;rotate() ​
void rotate(num angle)Implementation
dart
void rotate(num angle) native;save() ​
void save()Implementation
dart
void save() native;scale() ​
Implementation
dart
void scale(num x, num y) native;scrollPathIntoView() ​
void scrollPathIntoView([Path2D? path])Implementation
dart
void scrollPathIntoView([Path2D? path]) native;setFillColorHsl() ​
Sets the color used inside shapes. h is in degrees, 0-360. s, l are in percent, 0-100. a is 0-1.
Implementation
dart
void setFillColorHsl(int h, num s, num l, [num a = 1]) {
this.fillStyle = 'hsla($h, $s%, $l%, $a)';
}setFillColorRgb() ​
Sets the color used inside shapes. r, g, b are 0-255, a is 0-1.
Implementation
dart
void setFillColorRgb(int r, int g, int b, [num a = 1]) {
this.fillStyle = 'rgba($r, $g, $b, $a)';
}setLineDash() ​
Implementation
dart
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@SupportedBrowser(SupportedBrowser.IE, '11')
@Unstable()
void setLineDash(List<num> dash) {
// TODO(14316): Firefox has this functionality with mozDash, but it's a bit
// different.
if (JS('bool', '!!#.setLineDash', this)) {
JS('void', '#.setLineDash(#)', this, dash);
} else if (JS('bool', '!!#.webkitLineDash', this)) {
JS('void', '#.webkitLineDash = #', this, dash);
}
}setStrokeColorHsl() ​
Sets the color used for stroking shapes. h is in degrees, 0-360. s, l are in percent, 0-100. a is 0-1.
Implementation
dart
void setStrokeColorHsl(int h, num s, num l, [num a = 1]) {
this.strokeStyle = 'hsla($h, $s%, $l%, $a)';
}setStrokeColorRgb() ​
Sets the color used for stroking shapes. r, g, b are 0-255, a is 0-1.
Implementation
dart
void setStrokeColorRgb(int r, int g, int b, [num a = 1]) {
this.strokeStyle = 'rgba($r, $g, $b, $a)';
}setTransform() ​
Implementation
dart
void setTransform(num a, num b, num c, num d, num e, num f) native;stroke() ​
void stroke([Path2D? path])Implementation
dart
void stroke([Path2D? path]) native;strokeRect() ​
Implementation
dart
void strokeRect(num x, num y, num width, num height) native;strokeText() ​
Implementation
dart
void strokeText(String text, num x, num y, [num? maxWidth]) native;toString() inherited ​
String toString()A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.
Inherited from Interceptor.
Implementation
dart
String toString() => Primitives.objectToHumanReadableString(this);transform() ​
Implementation
dart
void transform(num a, num b, num c, num d, num e, num f) native;translate() ​
Implementation
dart
void translate(num x, num y) native;Operators ​
operator ==() inherited ​
The equality operator.
The default behavior for all Objects is to return true if and only if this object and other are the same object.
Override this method to specify a different equality relation on a class. The overriding method must still be an equivalence relation. That is, it must be:
Total: It must return a boolean for all arguments. It should never throw.
Reflexive: For all objects
o,o == omust be true.Symmetric: For all objects
o1ando2,o1 == o2ando2 == o1must either both be true, or both be false.Transitive: For all objects
o1,o2, ando3, ifo1 == o2ando2 == o3are true, theno1 == o3must be true.
The method should also be consistent over time, so whether two objects are equal should only change if at least one of the objects was modified.
If a subclass overrides the equality operator, it should override the hashCode method as well to maintain consistency.
Inherited from Interceptor.
Implementation
dart
bool operator ==(Object other) => identical(this, other);