deferUntilModulesLoaded method

  1. @override
bool deferUntilModulesLoaded(
  1. void resolve()
)
override

Runs resolve once the outermost loadModule returns, because it needs a name that is not declared yet. Dart has no declaration order across libraries: in an import cycle (intl's intl_helpers.dart and message_lookup_by_library.dart), or through a barrel that has not reached the export declaring it, a class can be visited before its supertype - or a method before its type-parameter bound - exists anywhere. Returns false when no module load is in progress: then the name is genuinely undefined and the caller reports it. resolve reports a name that is still undefined when it runs.

Implementation

@override
bool deferUntilModulesLoaded(void Function() resolve) {
  if (_loadDepth == 0) return false;
  _deferredUntilLoaded.add(resolve);
  return true;
}