dev
dart 15 lines 378 Bytes
Raw
1 import 'dart:convert';
2
3 import 'package:flutter/services.dart';
4
5 class TestAssetBundle extends CachingAssetBundle {
6 @override
7 Future<String> loadString(String key, {bool cache = true}) async {
8 final ByteData data = await load(key);
9
10 return utf8.decode(data.buffer.asUint8List());
11 }
12
13 @override
14 Future<ByteData> load(String key) async => rootBundle.load(key);
15 }