Skip to content

Commit 1d862ec

Browse files
Document AssetBundle loadString Decoding Behavior (flutter#88822)
1 parent 52b4942 commit 1d862ec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/flutter/lib/src/services/asset_bundle.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,12 @@ abstract class AssetBundle {
6262
/// If the `cache` argument is set to false, then the data will not be
6363
/// cached, and reading the data may bypass the cache. This is useful if the
6464
/// caller is going to be doing its own caching. (It might not be cached if
65-
/// it's set to true either, that depends on the asset bundle
66-
/// implementation.)
65+
/// it's set to true either, depending on the asset bundle implementation.)
66+
///
67+
/// The function expects the stored string to be UTF-8-encoded as
68+
/// [Utf8Codec] will be used for decoding the string. If the string is
69+
/// larger than 50 KB, the decoding process is delegated to an
70+
/// isolate to avoid jank on the main thread.
6771
Future<String> loadString(String key, { bool cache = true }) async {
6872
final ByteData data = await load(key);
6973
if (data == null)

0 commit comments

Comments
 (0)