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
setState() called after dispose() #75
Comments
could u provide a minimal reproducible code?
…On Tue, 22 Mar 2022 at 9:46 PM, Pk ***@***.***> wrote:
E/flutter ( 7192): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled
Exception: setState() called after dispose(): _GNavState#fb094(lifecycle
state: defunct, not mounted)
E/flutter ( 7192): This error happens if you call setState() on a State
object for a widget that no longer appears in the widget tree (e.g., whose
parent widget no longer includes the widget in its build). This error can
occur when code calls setState() from a timer or an animation callback.
E/flutter ( 7192): The preferred solution is to cancel the timer or stop
listening to the animation in the dispose() callback. Another solution is
to check the "mounted" property of this object before calling setState() to
ensure the object is still in the tree.
E/flutter ( 7192): This error might indicate a memory leak if setState()
is being called because another object is retaining a reference to this
State object after it has been removed from the tree. To avoid memory
leaks, consider breaking the reference to this object during dispose().
—
Reply to this email directly, view it on GitHub
<#75>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
I’m not able to run this, _onItemTapped is missing
…On Tue, 22 Mar 2022 at 9:59 PM, Pk ***@***.***> wrote:
could u provide a minimal reproducible code?
… <#m_587440306533223400_>
On Tue, 22 Mar 2022 at 9:46 PM, Pk *@*.*> wrote: E/flutter ( 7192):
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception:
setState() called after dispose(): _GNavState#fb094(lifecycle state:
defunct, not mounted) E/flutter ( 7192): This error happens if you call
setState() on a State object for a widget that no longer appears in the
widget tree (e.g., whose parent widget no longer includes the widget in its
build). This error can occur when code calls setState() from a timer or an
animation callback. E/flutter ( 7192): The preferred solution is to cancel
the timer or stop listening to the animation in the dispose() callback.
Another solution is to check the "mounted" property of this object before
calling setState() to ensure the object is still in the tree. E/flutter (
7192): This error might indicate a memory leak if setState() is being
called because another object is retaining a reference to this State object
after it has been removed from the tree. To avoid memory leaks, consider
breaking the reference to this object during dispose(). — Reply to this
email directly, view it on GitHub <#75
<#75>>, or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A
<https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A>
. You are receiving this because you are subscribed to this thread.Message
ID: @.*>
bottomNavigationBar: Container(
// height: kBottomNavigationBarHeight,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
blurRadius: 20,
color: Colors.black.withOpacity(.1),
)
],
),
child: SafeArea(
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 24.0, vertical: 8),
child: GNav(
rippleColor: AppColor.surfaceDisabled1,
hoverColor: AppColor.surfaceDisabled1,
gap: 4,
activeColor: AppColor.splash,
iconSize: 24,
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
tabBackgroundColor: AppColor.surfaceDisabled1,
color: AppColor.surfaceDisabled1,
tabs: [
GButton(
leading: Image.asset(
Images.tab1,
height: 24,
width: 24,
),
text: 'tab1'.tr,
textStyle: AppTextStyle.addBtnTxt
.copyWith(color: AppColor.primaryFontBlack),
icon: null,
),
GButton(
leading: Image.asset(
Images.tab2,
height: 24,
width: 24,
),
text: 'tab2'.tr,
textStyle: AppTextStyle.addBtnTxt
.copyWith(color: AppColor.primaryFontBlack),
icon: null,
),
GButton(
leading: Image.asset(
Images.tab3,
height: 24,
width: 24,
),
text: 'tab3'.tr,
textStyle: AppTextStyle.addBtnTxt
.copyWith(color: AppColor.primaryFontBlack),
icon: null,
),
GButton(
leading: Image.asset(
Images.tab4,
height: 24,
width: 24,
),
text: 'tab4'.tr,
textStyle: AppTextStyle.addBtnTxt
.copyWith(color: AppColor.primaryFontBlack),
icon: null,
),
],
selectedIndex: _selectedIndex,
onTabChange: (index) {
if (mounted)
setState(() {
_selectedIndex = index;
_onItemTapped(index);
});
},
),
),
),
),
—
Reply to this email directly, view it on GitHub
<#75 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADGCEC2CGGW3Q2OT544LPNTVBHG2NANCNFSM5RK6EZ7A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
|
Could you just send me a complete file that is runnable? currentPage Is
missing
…On Tue, 22 Mar 2022 at 10:06 PM, Pk ***@***.***> wrote:
I’m not able to run this,
*onItemTapped is missing … <#m_3194987528613587962_> On Tue, 22 Mar 2022
at 9:59 PM, Pk @.***> wrote: could u provide a minimal reproducible code? …
<#m_587440306533223400*> On Tue, 22 Mar 2022 at 9:46 PM, Pk *@*.*> wrote:
E/flutter ( 7192): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled
Exception: setState() called after dispose(): _GNavState#fb094(lifecycle
state: defunct, not mounted) E/flutter ( 7192): This error happens if you
call setState() on a State object for a widget that no longer appears in
the widget tree (e.g., whose parent widget no longer includes the widget in
its build). This error can occur when code calls setState() from a timer or
an animation callback. E/flutter ( 7192): The preferred solution is to
cancel the timer or stop listening to the animation in the dispose()
callback. Another solution is to check the "mounted" property of this
object before calling setState() to ensure the object is still in the tree.
E/flutter ( 7192): This error might indicate a memory leak if setState() is
being called because another object is retaining a reference to this State
object after it has been removed from the tree. To avoid memory leaks,
consider breaking the reference to this object during dispose(). — Reply to
this email directly, view it on GitHub <#75
<#75> <#75
<#75>>>, or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A
<https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A>
https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A
<https://github.com/notifications/unsubscribe-auth/ADGCEC7AHFHPEMJLAFM7D73VBHFJ7ANCNFSM5RK6EZ7A>
. You are receiving this because you are subscribed to this thread.Message
ID: @.*> bottomNavigationBar: Container( // height:
kBottomNavigationBarHeight, decoration: BoxDecoration( color: Colors.white,
boxShadow: [ BoxShadow( blurRadius: 20, color:
Colors.black.withOpacity(.1), ) ], ), child: SafeArea( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 8), child:
GNav( rippleColor: AppColor.surfaceDisabled1, hoverColor:
AppColor.surfaceDisabled1, gap: 4, activeColor: AppColor.splash, iconSize:
24, padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
tabBackgroundColor: AppColor.surfaceDisabled1, color:
AppColor.surfaceDisabled1, tabs: [ GButton( leading: Image.asset(
Images.tab1, height: 24, width: 24, ), text: 'tab1'.tr, textStyle:
AppTextStyle.addBtnTxt .copyWith(color: AppColor.primaryFontBlack), icon:
null, ), GButton( leading: Image.asset( Images.tab2, height: 24, width: 24,
), text: 'tab2'.tr, textStyle: AppTextStyle.addBtnTxt .copyWith(color:
AppColor.primaryFontBlack), icon: null, ), GButton( leading: Image.asset(
Images.tab3, height: 24, width: 24, ), text: 'tab3'.tr, textStyle:
AppTextStyle.addBtnTxt .copyWith(color: AppColor.primaryFontBlack), icon:
null, ), GButton( leading: Image.asset( Images.tab4, height: 24, width: 24,
), text: 'tab4'.tr, textStyle: AppTextStyle.addBtnTxt .copyWith(color:
AppColor.primaryFontBlack), icon: null, ), ], selectedIndex:
_selectedIndex, onTabChange: (index) { if (mounted) setState(() {
_selectedIndex = index; _onItemTapped(index); }); }, ), ), ), ), — Reply to
this email directly, view it on GitHub <#75 (comment)
<#75 (comment)>>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADGCEC2CGGW3Q2OT544LPNTVBHG2NANCNFSM5RK6EZ7A
. You are receiving this because you commented.Message ID: *@*.***>
void _onItemTapped(int index) { if (mounted) setState(() { _selectedIndex
= index; _currentPage = _pages[index]; }); }
—
Reply to this email directly, view it on GitHub
<#75 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADGCECZ6TAIFJT4VL642PZ3VBHHU3ANCNFSM5RK6EZ7A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
https://gist.github.com/pradeep14598/b191d0bacd5ae9d67d1e6094152a4183 |
@pradeep14598 the DashboardController is missing, could you make it runnable first in one single file? |
https://gist.github.com/pradeep14598/b191d0bacd5ae9d67d1e6094152a4183 |
@pradeep14598 you shouldnt put your you should put at here class Test extends StatefulWidget {
final String? title;
final GlobalKey<ScaffoldState> _scaffoldkey = new GlobalKey<ScaffoldState>();
Test({@required this.title});
@override
_TestState createState() => _TestState();
}
class _TestState extends State<Test> {
@override
Widget build(BuildContext context) {
}
}
|
Hai @sooxt98 ,Thanks for your solution and your awesome plugin ,is there any feature for adding badges in tab |
@pradeep14598 you could look into this badge example https://github.com/sooxt98/google_nav_bar/blob/master/example/lib/main_advance.dart |
E/flutter ( 7192): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: setState() called after dispose(): _GNavState#fb094(lifecycle state: defunct, not mounted)
E/flutter ( 7192): This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.
E/flutter ( 7192): The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
E/flutter ( 7192): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
The text was updated successfully, but these errors were encountered: