retrieveCalculatorDocument method

  1. @protected
Future<D> retrieveCalculatorDocument()

Retrieves the calculator document by merging the saved document with the default calculator document.

This method is called when the bloc is initialized.

Implementation

@protected
Future<D> retrieveCalculatorDocument() async {
  if (await canSaveUserEntry()) {
    final savedDocument = await dataProvider.retrieveCalculatorDocument();
    debugLog(
      'retrieved saved calculator bloc document',
      value: savedDocument,
      debugLabel: debugLabel,
    );

    return defaultDocument.merge(savedDocument) as D;
  }

  return defaultDocument;
}