Improve the format in asset_bundle.dart
(#126229)
Just found these extra intents and the very long line which might be improved. Related git blame: https://github.com/flutter/flutter/blame/master/packages/flutter/lib/src/services/asset_bundle.dart#L337.
This commit is contained in:
parent
431dfc8326
commit
6b756ab5ff
@ -323,7 +323,10 @@ class PlatformAssetBundle extends CachingAssetBundle {
|
|||||||
@override
|
@override
|
||||||
Future<ByteData> load(String key) {
|
Future<ByteData> load(String key) {
|
||||||
final Uint8List encoded = utf8.encoder.convert(Uri(path: Uri.encodeFull(key)).path);
|
final Uint8List encoded = utf8.encoder.convert(Uri(path: Uri.encodeFull(key)).path);
|
||||||
final Future<ByteData>? future = ServicesBinding.instance.defaultBinaryMessenger.send('flutter/assets', encoded.buffer.asByteData())?.then((ByteData? asset) {
|
final Future<ByteData>? future = ServicesBinding.instance.defaultBinaryMessenger.send(
|
||||||
|
'flutter/assets',
|
||||||
|
encoded.buffer.asByteData(),
|
||||||
|
)?.then((ByteData? asset) {
|
||||||
if (asset == null) {
|
if (asset == null) {
|
||||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||||
_errorSummaryWithKey(key),
|
_errorSummaryWithKey(key),
|
||||||
@ -334,9 +337,9 @@ class PlatformAssetBundle extends CachingAssetBundle {
|
|||||||
});
|
});
|
||||||
if (future == null) {
|
if (future == null) {
|
||||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||||
_errorSummaryWithKey(key),
|
_errorSummaryWithKey(key),
|
||||||
ErrorDescription('The asset does not exist or has empty data.'),
|
ErrorDescription('The asset does not exist or has empty data.'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user