load method Null safety

Future<ResourceManager> load()

Implementation

Future<ResourceManager> load() async {
  final futures = pendingResources.map((r) => r.complete);
  await Future.wait(futures);
  final errors = failedResources.length;
  if (errors > 0) {
    throw StateError('Failed to load $errors resource(s).');
  } else {
    return this;
  }
}