initialize method

  1. @override
  2. @mustCallSuper
Future<void> initialize()
override

Initializes the bloc by connecting to the data provider and retrieving the default and saved calculator documents.

This method is called when the bloc is created and sets up the initial state for the bloc.

Implementation

@override
@mustCallSuper
Future<void> initialize() async {
  debugLog('initializing calculator bloc...', debugLabel: debugLabel);
  await dataProvider.connect();

  defaultDocument = await retrieveDefaultCalculatorDocument();
  debugLog(
    'retrieved default calculator bloc document',
    value: defaultDocument,
    debugLabel: debugLabel,
  );

  document = await retrieveCalculatorDocument();
  debugLog(
    'will use calculator bloc document',
    value: document,
    debugLabel: debugLabel,
  );
}