perf(bridge): reduce metadata copies and decode large JSON off the UI isolate

Keep decoded cache objects private and copy only at public return boundaries. Decode large metadata and persisted JSON in a worker, and read spill files in the decoding isolate with cleanup on failure.

Protect replacement in-flight requests from stale cleanup. Cover nested mutation isolation, coalescing, invalidation, restoration, spill cleanup and retries.
This commit is contained in:
zarzet committed 2026-09-20 17:21:11 +07:00
1 parent 7691acecef
commit 48ba08976a
3 files changed
+248 -16

No files matched your search

@@ -23,6 +23,7 @@ void main() {
'artist_name': 'Artist',
'album_name': 'Album',
'duration': 123000,
'external_links': {'example': 'https://example.invalid/track/$index'},
},
);
final json = jsonEncode(rows);
@@ -42,6 +43,8 @@ void main() {
);
expect(result, rows);
result.first['name'] = 'Changed by caller';
(result.first['external_links'] as Map<String, dynamic>)['example'] =
'Changed by caller';
final cached = await PlatformBridge.customSearchWithExtension(
'decode-test-$format',
'query',