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
|
||||
Future<ByteData> load(String key) {
|
||||
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) {
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
_errorSummaryWithKey(key),
|
||||
@ -334,9 +337,9 @@ class PlatformAssetBundle extends CachingAssetBundle {
|
||||
});
|
||||
if (future == null) {
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
_errorSummaryWithKey(key),
|
||||
ErrorDescription('The asset does not exist or has empty data.'),
|
||||
]);
|
||||
_errorSummaryWithKey(key),
|
||||
ErrorDescription('The asset does not exist or has empty data.'),
|
||||
]);
|
||||
}
|
||||
return future;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user