add<T> method
Tracks load and returns it unchanged, so the call reads inline:
final node = await loading.add(Node.fromGlbAsset('player.glb'));
A failed load counts toward completion (so ready still resolves) and its error is recorded in failures; it does not abort the group.
Implementation
Future<T> add<T>(Future<T> load) {
_total++;
_updateProgress();
_tracked.add(
load.then(
(_) => _markSettled(),
onError: (Object error, StackTrace stack) {
_failures.add(error);
_markSettled();
},
),
);
return load;
}