onChange method

  1. @override
void onChange(
  1. BlocBase bloc,
  2. Change change
)

Called whenever a Change occurs in any bloc A change occurs when a new state is emitted. onChange is called before a bloc's state has been updated.

Implementation

@override
void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) {
  super.onChange(bloc, change);
  final changeString = change.toString();
  final isFilterContains = filters.any(changeString.contains);
  if (!settings.enabled || !settings.printChanges || isFilterContains) {
    return;
  }
  onBlocChange?.call(bloc, change);
  _iSpectify.logCustom(
    BlocChangeLog(
      bloc: bloc,
      change: change,
      settings: settings,
    ),
  );
}