Move the documentation for compute to the ComputeImpl typedef (#88264)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user