onLoadingBuilder method Null safety

Widget? onLoadingBuilder(
  1. BuildContext context,
  2. BuildMetadata meta,
  3. [double? loadingProgress,
  4. dynamic data]
)

Builder for loading widget while a complicated element is loading.

See OnLoadingBuilder.

Implementation

Widget? onLoadingBuilder(
  BuildContext context,
  BuildMetadata meta, [
  double? loadingProgress,
  dynamic data,
]) {
  final callback = _widget?.onLoadingBuilder;
  if (callback != null) {
    final result = callback(context, meta.element, loadingProgress);
    if (result != null) {
      return result;
    }
  }

  return Center(
    child: Padding(
      padding: const EdgeInsets.all(8),
      child: debugDeterministicLoadingWidget
          ? const Text('Loading...')
          : CircularProgressIndicator.adaptive(value: loadingProgress),
    ),
  );
}