Skip to content

feat: Improve BlocObserver.onChange readability with structured state diff #4538

@adonisRodxander

Description

@adonisRodxander

Hi, thanks for the great work on flutter_bloc!

I'm currently using a custom BlocObserver and in the onChange method I log change.toString(). This gives me the current and next states, which works — but it's hard to read and not very useful for debugging complex states.

I'm using freezed, so both states are deeply nested and verbose when printed.

Would it be possible for the Change class or BlocObserver to provide a more structured representation? For example, a method that returns a Map<String, dynamic> diff, or a utility to format state transitions more clearly?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions