Skip to main content

Loading

C2CLoading is a utility class in Flutter for managing and displaying loading indicators within an application. It supports multiple loading indicators identified by unique IDs and offers customizable options for the loading widget and backdrop color. This class ensures a consistent and centralized way to handle loading states across the application.

Example Usage

Showing a Loading Indicator

C2CLoading.show(id: 'myLoadingId');

Hiding a Loading Indicator

C2CLoading.hide(id: 'myLoadingId');

Dismissing All Loading Indicators

C2CLoading.dismiss();

Methods

init(BuildContext context)

Initializes the C2CLoading with the given context.

Note: By default, C2CCore.init() called this method. You don't need to call it again.

show({...})

Displays a loading indicator with the specified ID.

PropertyDescriptionType
idA unique identifier for the loading indicator.String
contextThe BuildContext where the loading indicator shows.BuildContext?
backdropColorThe color of the backdrop behind the loading widget.Color?
loadingWidgetThe widget to be displayed as a loading indicator.Widget?

hide({...})

Hides the loading indicator with the specified ID.

Parameters:

  • String id: Identify the loading indicator

dismiss()

Hides all active loading indicators.