Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"The getter 'position' was called on null" throws when using a FadingEdgeScrollView inside the TabBarView #8

Closed
shemhazai opened this issue Jun 27, 2020 · 1 comment

Comments

@shemhazai
Copy link

A null pointer exception is thrown when using the FadingEdgeScrollView inside the TabBarView.

Steps to reproduce:

  1. Clone this repo with a minimum code which reproduces the problem: shemhazai/flutter_fading_edge_scrollview
  2. Navigate through pages by clicking on the TabBar tabs (must not be adjacent tabs).
  3. The exception is thrown (as posted below).

I/flutter ( 6149): ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY >╞═════════════════════════════════════════════════════════
I/flutter ( 6149): The following NoSuchMethodError was thrown during a scheduler callback:
I/flutter ( 6149): The getter 'position' was called on null.
I/flutter ( 6149): Receiver: null
I/flutter ( 6149): Tried calling: position
I/flutter ( 6149):
I/flutter ( 6149): When the exception was thrown, this was the stack:
I/flutter ( 6149): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
I/flutter ( 6149): #1 _FadingEdgeScrollViewState.initState. (package:fading_edge_scrollview/src/fading_edge_scrollview.dart:168:23)
I/flutter ( 6149): #2 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)
I/flutter ( 6149): #3 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1060:9)
I/flutter ( 6149): #4 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:968:5)
I/flutter ( 6149): #8 _invoke (dart:ui/hooks.dart:261:10)
I/flutter ( 6149): #9 _drawFrame (dart:ui/hooks.dart:219:3)
I/flutter ( 6149): (elided 3 frames from dart:async)

I did not experience this exception when I was using the FadingEdgeScrollView without the TabBarView - so most likely this is an important factor to consider.

@mponkin
Copy link
Owner

mponkin commented Jun 29, 2020

Turns out in this situation PostFrameCallback happens after the widget is disposed. So I added check for this.
Fix is available in version 1.1.4
Thank you for pointing out this problem and providing such helpful description

@mponkin mponkin closed this as completed Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants