Auto-format Framework (#160545)
This auto-formats all *.dart files in the repository outside of the `engine` subdirectory and enforces that these files stay formatted with a presubmit check. **Reviewers:** Please carefully review all the commits except for the one titled "formatted". The "formatted" commit was auto-generated by running `dev/tools/format.sh -a -f`. The other commits were hand-crafted to prepare the repo for the formatting change. I recommend reviewing the commits one-by-one via the "Commits" tab and avoiding Github's "Files changed" tab as it will likely slow down your browser because of the size of this PR. --------- Co-authored-by: Kate Lovett <katelovett@google.com> Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8e0993eda8
commit
5491c8c146
@@ -44,13 +44,11 @@ class PathUrlStrategy extends ui_web.HashUrlStrategy {
|
||||
///
|
||||
/// The [ui_web.PlatformLocation] parameter is useful for testing to mock out browser
|
||||
/// interactions.
|
||||
PathUrlStrategy([
|
||||
super.platformLocation,
|
||||
this.includeHash = false,
|
||||
]) : _platformLocation = platformLocation,
|
||||
_basePath = stripTrailingSlash(extractPathname(checkBaseHref(
|
||||
platformLocation.getBaseHref(),
|
||||
)));
|
||||
PathUrlStrategy([super.platformLocation, this.includeHash = false])
|
||||
: _platformLocation = platformLocation,
|
||||
_basePath = stripTrailingSlash(
|
||||
extractPathname(checkBaseHref(platformLocation.getBaseHref())),
|
||||
);
|
||||
|
||||
final ui_web.PlatformLocation _platformLocation;
|
||||
final String _basePath;
|
||||
|
||||
@@ -129,5 +129,5 @@ class PathUrlStrategy extends HashUrlStrategy {
|
||||
///
|
||||
/// The [PlatformLocation] parameter is useful for testing to mock out browser
|
||||
/// integrations.
|
||||
const PathUrlStrategy([PlatformLocation? _, bool __ = false,]);
|
||||
const PathUrlStrategy([PlatformLocation? _, bool __ = false]);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class PluginEventChannel<T> {
|
||||
/// and providing a getter would require making this class non-const.
|
||||
@Deprecated(
|
||||
'Replace calls to the "controller" setter with calls to the "setController" method. '
|
||||
'This feature was deprecated after v1.23.0-7.0.pre.'
|
||||
'This feature was deprecated after v1.23.0-7.0.pre.',
|
||||
)
|
||||
// ignore: avoid_setters_without_getters
|
||||
set controller(StreamController<T> controller) {
|
||||
@@ -98,12 +98,7 @@ class PluginEventChannel<T> {
|
||||
}
|
||||
|
||||
class _EventChannelHandler<T> {
|
||||
_EventChannelHandler(
|
||||
this.name,
|
||||
this.codec,
|
||||
this.controller,
|
||||
this.messenger,
|
||||
);
|
||||
_EventChannelHandler(this.name, this.codec, this.controller, this.messenger);
|
||||
|
||||
final String name;
|
||||
final MethodCodec codec;
|
||||
@@ -128,20 +123,20 @@ class _EventChannelHandler<T> {
|
||||
Future<ByteData> _listen() async {
|
||||
// Cancel any existing subscription.
|
||||
await subscription?.cancel();
|
||||
subscription = controller.stream.listen((dynamic event) {
|
||||
messenger.send(name, codec.encodeSuccessEnvelope(event));
|
||||
}, onError: (dynamic error) {
|
||||
messenger.send(name, codec.encodeErrorEnvelope(code: 'error', message: '$error'));
|
||||
});
|
||||
subscription = controller.stream.listen(
|
||||
(dynamic event) {
|
||||
messenger.send(name, codec.encodeSuccessEnvelope(event));
|
||||
},
|
||||
onError: (dynamic error) {
|
||||
messenger.send(name, codec.encodeErrorEnvelope(code: 'error', message: '$error'));
|
||||
},
|
||||
);
|
||||
return codec.encodeSuccessEnvelope(null);
|
||||
}
|
||||
|
||||
Future<ByteData> _cancel() async {
|
||||
if (subscription == null) {
|
||||
return codec.encodeErrorEnvelope(
|
||||
code: 'error',
|
||||
message: 'No active subscription to cancel.',
|
||||
);
|
||||
return codec.encodeErrorEnvelope(code: 'error', message: 'No active subscription to cancel.');
|
||||
}
|
||||
await subscription!.cancel();
|
||||
subscription = null;
|
||||
|
||||
@@ -54,7 +54,7 @@ class Registrar extends BinaryMessenger {
|
||||
Registrar([
|
||||
@Deprecated(
|
||||
'This argument is ignored. '
|
||||
'This feature was deprecated after v1.24.0-7.0.pre.'
|
||||
'This feature was deprecated after v1.24.0-7.0.pre.',
|
||||
)
|
||||
BinaryMessenger? binaryMessenger,
|
||||
]);
|
||||
@@ -81,7 +81,7 @@ class Registrar extends BinaryMessenger {
|
||||
/// This method has been replaced with the more clearly-named [handleFrameworkMessage].
|
||||
@Deprecated(
|
||||
'Use handleFrameworkMessage instead. '
|
||||
'This feature was deprecated after v1.24.0-7.0.pre.'
|
||||
'This feature was deprecated after v1.24.0-7.0.pre.',
|
||||
)
|
||||
@override
|
||||
Future<void> handlePlatformMessage(
|
||||
@@ -125,12 +125,14 @@ class Registrar extends BinaryMessenger {
|
||||
response = await handler(data);
|
||||
}
|
||||
} catch (exception, stack) {
|
||||
FlutterError.reportError(FlutterErrorDetails(
|
||||
exception: exception,
|
||||
stack: stack,
|
||||
library: 'flutter web plugins',
|
||||
context: ErrorDescription('during a framework-to-plugin message'),
|
||||
));
|
||||
FlutterError.reportError(
|
||||
FlutterErrorDetails(
|
||||
exception: exception,
|
||||
stack: stack,
|
||||
library: 'flutter web plugins',
|
||||
context: ErrorDescription('during a framework-to-plugin message'),
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
if (callback != null) {
|
||||
callback(response);
|
||||
@@ -141,7 +143,7 @@ class Registrar extends BinaryMessenger {
|
||||
/// Returns `this`.
|
||||
@Deprecated(
|
||||
'This property is redundant. It returns the object on which it is called. '
|
||||
'This feature was deprecated after v1.24.0-7.0.pre.'
|
||||
'This feature was deprecated after v1.24.0-7.0.pre.',
|
||||
)
|
||||
BinaryMessenger get messenger => this;
|
||||
|
||||
@@ -155,12 +157,14 @@ class Registrar extends BinaryMessenger {
|
||||
try {
|
||||
completer.complete(reply);
|
||||
} catch (exception, stack) {
|
||||
FlutterError.reportError(FlutterErrorDetails(
|
||||
exception: exception,
|
||||
stack: stack,
|
||||
library: 'flutter web plugins',
|
||||
context: ErrorDescription('during a plugin-to-framework message'),
|
||||
));
|
||||
FlutterError.reportError(
|
||||
FlutterErrorDetails(
|
||||
exception: exception,
|
||||
stack: stack,
|
||||
library: 'flutter web plugins',
|
||||
context: ErrorDescription('during a plugin-to-framework message'),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
return completer.future;
|
||||
@@ -180,7 +184,7 @@ class Registrar extends BinaryMessenger {
|
||||
/// as part of a simplification of the web plugins API.
|
||||
@Deprecated(
|
||||
'Use Registrar instead. '
|
||||
'This feature was deprecated after v1.26.0-18.0.pre.'
|
||||
'This feature was deprecated after v1.26.0-18.0.pre.',
|
||||
)
|
||||
class PluginRegistry extends Registrar {
|
||||
/// Creates a [Registrar].
|
||||
@@ -188,12 +192,12 @@ class PluginRegistry extends Registrar {
|
||||
/// The argument is ignored.
|
||||
@Deprecated(
|
||||
'Use Registrar instead. '
|
||||
'This feature was deprecated after v1.26.0-18.0.pre.'
|
||||
'This feature was deprecated after v1.26.0-18.0.pre.',
|
||||
)
|
||||
PluginRegistry([
|
||||
@Deprecated(
|
||||
'This argument is ignored. '
|
||||
'This feature was deprecated after v1.26.0-18.0.pre.'
|
||||
'This feature was deprecated after v1.26.0-18.0.pre.',
|
||||
)
|
||||
BinaryMessenger? binaryMessenger,
|
||||
]) : super();
|
||||
@@ -201,7 +205,7 @@ class PluginRegistry extends Registrar {
|
||||
/// Returns `this`. The argument is ignored.
|
||||
@Deprecated(
|
||||
'This method is redundant. It returns the object on which it is called. '
|
||||
'This feature was deprecated after v1.26.0-18.0.pre.'
|
||||
'This feature was deprecated after v1.26.0-18.0.pre.',
|
||||
)
|
||||
Registrar registrarFor(Type key) => this;
|
||||
}
|
||||
@@ -212,13 +216,13 @@ final Registrar webPluginRegistrar = PluginRegistry();
|
||||
/// A deprecated alias for [webPluginRegistrar].
|
||||
@Deprecated(
|
||||
'Use webPluginRegistrar instead. '
|
||||
'This feature was deprecated after v1.24.0-7.0.pre.'
|
||||
'This feature was deprecated after v1.24.0-7.0.pre.',
|
||||
)
|
||||
PluginRegistry get webPluginRegistry => webPluginRegistrar as PluginRegistry;
|
||||
|
||||
/// A deprecated alias for [webPluginRegistrar].
|
||||
@Deprecated(
|
||||
'Use webPluginRegistrar instead. '
|
||||
'This feature was deprecated after v1.24.0-7.0.pre.'
|
||||
'This feature was deprecated after v1.24.0-7.0.pre.',
|
||||
)
|
||||
BinaryMessenger get pluginBinaryMessenger => webPluginRegistrar;
|
||||
|
||||
Reference in New Issue
Block a user