This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[HR] Documentation cleanup #7370
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,31 +4,42 @@ | |
|
|
||
| part of dart.ui; | ||
|
|
||
| /// An wrapper for a raw callback handle. | ||
| /// A wrapper for a raw callback handle. | ||
| /// | ||
| /// This is the return type for [PluginUtilities.getCallbackHandle]. | ||
| class CallbackHandle { | ||
| final int _handle; | ||
|
|
||
| /// Create an instance using a raw callback handle. | ||
| /// | ||
| /// Only values produced by a call to [CallbackHandle.toRawHandle] should be | ||
| /// used, otherwise this object will be an invalid handle. | ||
| CallbackHandle.fromRawHandle(this._handle) | ||
| : assert(_handle != null, "'_handle' must not be null."); | ||
|
|
||
| /// Get the raw callback handle to pass over a [MethodChannel] or isolate | ||
| /// port. | ||
| final int _handle; | ||
|
|
||
| /// Get the raw callback handle to pass over a [MethodChannel] or [SendPort] | ||
| /// (to pass to another [Isolate]). | ||
| int toRawHandle() => _handle; | ||
|
|
||
| @override | ||
| int get hashCode => _handle; | ||
| bool operator ==(dynamic other) { | ||
| if (runtimeType != other.runtimeType) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any particular reason for this change here? Does this not accomplish the same thing?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original code used |
||
| return false; | ||
| final CallbackHandle typedOther = other; | ||
| return _handle == typedOther._handle; | ||
| } | ||
|
|
||
| @override | ||
| bool operator ==(dynamic other) => | ||
| (other is CallbackHandle) && (_handle == other._handle); | ||
| int get hashCode => _handle.hashCode; | ||
| } | ||
|
|
||
| /// Functionality for Flutter plugin authors. | ||
| abstract class PluginUtilities { | ||
| /// | ||
| /// See also: | ||
| /// | ||
| /// * [IsolateNameServer], which provides utilities for dealing with | ||
| /// [Isolate]s. | ||
| class PluginUtilities { | ||
| // This class is only a namespace, and should not be instantiated or | ||
| // extended directly. | ||
| factory PluginUtilities._() => null; | ||
|
|
@@ -41,7 +52,7 @@ abstract class PluginUtilities { | |
| /// Get a handle to a named top-level or static callback function which can | ||
| /// be easily passed between isolates. | ||
| /// | ||
| /// `callback` must not be null. | ||
| /// The `callback` argument must not be null. | ||
| /// | ||
| /// Returns a [CallbackHandle] that can be provided to | ||
| /// [PluginUtilities.getCallbackFromHandle] to retrieve a tear-off of the | ||
|
|
@@ -58,7 +69,7 @@ abstract class PluginUtilities { | |
| /// Get a tear-off of a named top-level or static callback represented by a | ||
| /// handle. | ||
| /// | ||
| /// `handle` must not be null. | ||
| /// The `handle` argument must not be null. | ||
| /// | ||
| /// If `handle` is not a valid handle returned by | ||
| /// [PluginUtilities.getCallbackHandle], null is returned. Otherwise, a | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe worth making this a macro
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave that for the next person who wants to do some cleanup :-)