Skip to content

[Bug?] Listener called when being rebuilt, even though no state changes #368

@matanshukry

Description

@matanshukry

Describe the bug
I have 2 pages with BlocListener in each of them. The Blocs them selves are kept in the
I have a BlocListener on my widget

To Reproduce
Create an app widget with blocs in the state.
Create 2 pages that you can navigate between them
In each page have a BlocListener widget on a state. Make sure the state doesn't change when navigating.

The 'listener' callback will be called every time the BlocListener is rebuilt, even though the state is the same.

Expected behavior
The listener callback in BlocListener should only be called once when the state changes, regardless if the BlocListener was just built or not.

**Logs **

$ flutter analyze
Analyzing my-app...
No issues found! (ran in 5.5s)

Paste the output of running flutter doctor -v here.

[√] Flutter (Channel dev, v1.7.4, on Microsoft Windows [Version 10.0.18362.175], locale en-US)
    • Flutter version 1.7.4 at C:\Flutter
    • Framework revision dfecafa4ab (7 days ago), 2019-06-14 09:46:23 -0700
    • Engine revision 2589785b5c
    • Dart version 2.4.0

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Android\Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = C:\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[√] Visual Studio - develop for Windows (Visual Studio Community 2017 15.9.10)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
    • Visual Studio Community 2017 version 15.9.28307.557

[√] Android Studio (version 3.4)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 36.1.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] IntelliJ IDEA Community Edition (version 2019.1)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.2
    • Flutter plugin version 36.0.4
    • Dart plugin version 191.7830

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

• No issues found!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions