onBlocChange method
void
onBlocChange(
- BlocBase bloc,
- Change change
Implementation
void onBlocChange(BlocBase bloc, Change change) async {
String? data;
try {
data = json.encode(
InvestigativePacket(
type: PacketType.blocTransitioned,
blocName: bloc.runtimeType.toString(),
identity: identity,
blocChange: BlocChange(
blocName: bloc.runtimeType.toString(),
eventName: "Generic",
oldState: change.currentState.toJson(),
newState: change.nextState.toJson(),
),
),
);
} on NoSuchMethodError {
data = json.encode(
InvestigativePacket(
type: PacketType.blocFallbackTransitioned,
identity: identity,
blocName: bloc.runtimeType.toString(),
oldFallbackState: change.currentState.toString(),
newFallbackState: change.nextState.toString(),
blocChange: BlocChange(
blocName: bloc.runtimeType.toString(),
eventName: "Generic",
)),
);
} catch (error) {
logger.e(error);
}
if (data != null) {
await _sendLog(data);
}
}