flutter_loader library Null safety

Copyright 2021 Hieu Rocker

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Simplifies resource loading with convenient builders.

Use DefaultLoaderBuilder for handling resource loading with default UI implementations for different states in LoaderState. For advanced usage, use LoaderBuilder.


A Widget that makes it easier to use LoaderBuilder by providing different WidgetBuilder for different states in the loader's lifecycle.
Defines the configuration of the overall visual Theme for a DefaultLoaderBuilder.
A Widget that replace its content with different widgets depends on the state of the loader.
A controller for the loader.


defaultErrorMessageResolver(dynamic error) String
The default ErrorMessageResolver.


State of the loader in its lifecycle: init -> loading <-> error or loaded


ErrorMessageResolver = String Function(dynamic error)
Signature for a function that converts an error into a String.
FutureProvider = Future Function()
Signature for a function that creates a Future.
LoaderWidgetBuilder = Widget Function(BuildContext, LoaderController, Widget?)
Signature for a function that creates a Widget from BuildContext, LoaderController and Widget. The given Widget is provided via LoaderBuilder.child for caching purpose.