Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1f5a1f74
Unverified
Commit
1f5a1f74
authored
Aug 30, 2021
by
James D. Lin
Committed by
GitHub
Aug 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the documentation for `compute` to the `ComputeImpl` typedef (#88264)
parent
616f9bcf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
isolates.dart
packages/flutter/lib/src/foundation/isolates.dart
+10
-5
print.dart
packages/flutter/lib/src/foundation/print.dart
+10
-6
No files found.
packages/flutter/lib/src/foundation/isolates.dart
View file @
1f5a1f74
...
...
@@ -17,11 +17,9 @@ import '_isolates_io.dart'
/// {@macro flutter.foundation.compute.limitations}
typedef
ComputeCallback
<
Q
,
R
>
=
FutureOr
<
R
>
Function
(
Q
message
);
/// The signature of [compute].
typedef
ComputeImpl
=
Future
<
R
>
Function
<
Q
,
R
>(
ComputeCallback
<
Q
,
R
>
callback
,
Q
message
,
{
String
?
debugLabel
});
/// Spawn an isolate, run `callback` on that isolate, passing it `message`, and
/// (eventually) return the value returned by `callback`.
/// The signature of [compute], which spawns an isolate, runs `callback` on
/// that isolate, passes it `message`, and (eventually) returns the value
/// returned by `callback`.
///
/// This is useful for operations that take longer than a few milliseconds, and
/// which would therefore risk skipping frames. For tasks that will only take a
...
...
@@ -44,4 +42,11 @@ typedef ComputeImpl = Future<R> Function<Q, R>(ComputeCallback<Q, R> callback, Q
///
/// The `debugLabel` argument can be specified to provide a name to add to the
/// [Timeline]. This is useful when profiling an application.
typedef
ComputeImpl
=
Future
<
R
>
Function
<
Q
,
R
>(
ComputeCallback
<
Q
,
R
>
callback
,
Q
message
,
{
String
?
debugLabel
});
/// A function that spawns an isolate and runs a callback on that isolate.
///
/// See also:
///
/// * [ComputeImpl], for function parameters and usage details.
const
ComputeImpl
compute
=
_isolates
.
compute
;
packages/flutter/lib/src/foundation/print.dart
View file @
1f5a1f74
...
...
@@ -6,13 +6,9 @@ import 'dart:async';
import
'dart:collection'
;
/// Signature for [debugPrint] implementations.
typedef
DebugPrintCallback
=
void
Function
(
String
?
message
,
{
int
?
wrapWidth
});
/// Prints a message to the console, which you can access using the "flutter"
/// tool's "logs" command ("flutter logs").
///
/// If a
wrapWidth is provided, each line of the message is word-wrapped to that
/// width. (Lines may be separated by newline characters, as in '\n'.)
/// If a
[wrapWidth] is provided, each line of the [message] is word-wrapped to
///
that
width. (Lines may be separated by newline characters, as in '\n'.)
///
/// By default, this function very crudely attempts to throttle the rate at
/// which messages are sent to avoid data loss on Android. This means that
...
...
@@ -26,6 +22,14 @@ typedef DebugPrintCallback = void Function(String? message, { int? wrapWidth });
///
/// The default value is [debugPrintThrottled]. For a version that acts
/// identically but does not throttle, use [debugPrintSynchronously].
typedef
DebugPrintCallback
=
void
Function
(
String
?
message
,
{
int
?
wrapWidth
});
/// Prints a message to the console, which you can access using the "flutter"
/// tool's "logs" command ("flutter logs").
///
/// See also:
///
/// * [DebugPrintCallback], for function parameters and usage details.
DebugPrintCallback
debugPrint
=
debugPrintThrottled
;
/// Alternative implementation of [debugPrint] that does not throttle.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment