Revert "Add API for discovering assets (#118410)" (#119273)

This reverts commit 2b8f2d0504.
This commit is contained in:
Christopher Fujino
2023-01-26 12:01:12 -08:00
committed by GitHub
parent 2b8f2d0504
commit a04ab7129b
6 changed files with 14 additions and 358 deletions

View File

@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/services.dart' show AssetManifest, PlatformAssetBundle, rootBundle;
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart' show PlatformAssetBundle;
import 'package:flutter/widgets.dart';
import '../common.dart';
@@ -15,12 +18,16 @@ void main() async {
final BenchmarkResultPrinter printer = BenchmarkResultPrinter();
WidgetsFlutterBinding.ensureInitialized();
final Stopwatch watch = Stopwatch();
final PlatformAssetBundle bundle = rootBundle as PlatformAssetBundle;
final PlatformAssetBundle bundle = PlatformAssetBundle();
final ByteData assetManifestBytes = await bundle.load('money_asset_manifest.json');
watch.start();
for (int i = 0; i < _kNumIterations; i++) {
await AssetManifest.loadFromAssetBundle(bundle);
bundle.clear();
final String json = utf8.decode(assetManifestBytes.buffer.asUint8List());
// This is a test, so we don't need to worry about this rule.
// ignore: invalid_use_of_visible_for_testing_member
await AssetImage.manifestParser(json);
}
watch.stop();