pageloaderBuilder function

Builder pageloaderBuilder(
  1. BuilderOptions options
)

Supports package:build_runner creation and configuration of pageloader.

Not meant to be invoked by hand-authored code.

Implementation

Builder pageloaderBuilder(BuilderOptions options) {
  // Paranoid copy of options.config - don't assume it's mutable or needed
  // elsewhere.
  final optionsMap = Map<String, dynamic>.from(options.config);

  final builder =
      SharedPartBuilder([const PageObjectGenerator()], 'pageloader');

  if (optionsMap.isNotEmpty) {
    // ignore: unnecessary_null_comparison
    if (log == null) {
      throw StateError('Upgrade `build_runner` to at least 0.8.2.');
    } else {
      log.warning('These options were ignored: `$optionsMap`.');
    }
  }
  return builder;
}