-
Notifications
You must be signed in to change notification settings - Fork 67
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
Getting error when call Wiredash.of(context).show(); #337
Comments
This issue is unrelated to Wiredash, but caused by go_router or your goRouter configuration. But I've seen similar issues in the past with routers when wiredash opens #282 #287 #289 BackgroundWhen Wiredash opens, it wraps your AppWidget with new additional widgets. This causes
Steps to resolve the issue:
Please let me know if you could resolve the issue! |
Hi,
Thanks for replying. I already declared my page as StatefulWidget and I
didn't use any dispose or didChangeDependencies methods as it is a simple
screen.
I defined my page route as below
GoRoute(
path: APPPAGE.profile.toName,
builder: (BuildContext context, GoRouterState state) {
return const ProfileScreen();
},
)
and navigate the page as follow
provider.scaffoldKey.currentContext!.push(APPPAGE.profile.toPath);
Still getting the same issue.
…On Fri, Mar 8, 2024 at 8:53 PM Pascal Welsch ***@***.***> wrote:
This issue is unrelated to Wiredash, but caused by go_router or your
goRouter configuration.
The the issue reported here flutter/flutter#112798
<flutter/flutter#112798>
But I've seen similar issues in the past with routers when wiredash opens
#282 <#282> #287
<#287> #289
<#289>
Therefore I can give you some recommendations, how to resolve the issue
Background
When Wiredash opens, it wraps your AppWidget with new additional widgets.
This causes
1.
Your widgets to rebuild (build() is called again)
From my experience, many apps do not expect that their topmost widget
will be rebuilt (ever). Most of them are StatelessWidget that
initialize stuff. When they get rebuilt, they initialize everything again,
leaving their app in an illegal state. (like recreating the router).
2.
Your widgets receive a call to didChangeDependencies().
Some apps have navigation or authentication redirect code in
didChangeDependencies(). This works because they only expect this
method to be called when their authentication changes. But now this method
is also called by Wiredash.
Steps to resolve the issue:
1.
Please ensure not to initialize your router in a StatelessWidget. Use
a StatefulWidget and keep your router in your state to survive rebuilds.
Also, double-check if you created the router inside your build method. This
will recreate it when the build method is called again.
2.
Prepare your app to *not* get disposed. Ensure, that the widgets below
Wiredash do not hold any state in their build method. StatelessWidget
widget do not keep final proprties!
Add a breakpoint to the dispose method of your widgets. They shouldn't
get disposed and recreated when Wiredash opens. Instead, only
didChangeDependencies should be called when you open Wiredash.
If you see any widgets getting disposed when opening Wiredash, there
is a bug in your app code that makes your app lose state (including your
router).
3.
Can't find the dispose issue? You could add a GlobalKey to the widget
that holds your router. It only works if you have a StatefulWidget and do
keep the router in your state.
Please let me know if you could resolve the issue!
—
Reply to this email directly, view it on GitHub
<#337 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BDG5PQDMXM2HHRBC6XYBHTDYXHJYHAVCNFSM6AAAAABEMPIL6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBVHA4DONJSGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Thanks and Regards,
Ribu Royson A,
Sr. Software Engineer
Emsyne – Muthoot Systems & Technologies Pvt Ltd
Lulu Cyber Tower 2 , 11th Floor, Infopark , Kochi
www.emsyne.com - +91 9995728766 || 8848605150
--
This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies and the original message. Any
unauthorized review, use, disclosure,dissemination, forwarding, printing or
copying of this email or any action taken in reliance on this e-mail is
strictly prohibited and may be unlawful. The recipient acknowledges that
Muthoot Finance Ltd or its subsidiaries and associated
companies(collectively "The Muthoot Group"),are unable to exercise control
or ensure or guarantee the integrity of/over the contents of the
information contained in e-mail transmissions and further acknowledges that
any views expressed in this message are those of the individual sender and
no binding nature of the message shall be implied or assumed unless the
sender does so expressly with due authority of Muthoot Finance Ltd. Before
opening any attachments please check them for viruses and defects.Virus
Warning: Although the company has taken reasonable precautions to ensure no
viruses are present in this email. The company cannot accept responsibility
for any loss or damage arising from the use of this email or attachment.
|
Where have you defined your router? |
We defined the router in main.dart as follows,
routerConfig: routes,
and we defined our route constants in routes.dart file.
For Example:
final routes = GoRouter(
routes: <RouteBase>[
GoRoute(
path: APPPAGE.splash.toPath,
builder: (BuildContext context, GoRouterState state) {
return const SplashScreen();
}, ........
…On Mon, Mar 11, 2024 at 2:21 PM Pascal Welsch ***@***.***> wrote:
Where have you defined your router?
Is any dispose method called? If you have not implemented them, do and
check.
—
Reply to this email directly, view it on GitHub
<#337 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BDG5PQDHUWCQNMGSMWOVP5DYXVWC7AVCNFSM6AAAAABEMPIL6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXHA4TSNZYGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Thanks and Regards,
Ribu Royson A,
Sr. Software Engineer
Emsyne – Muthoot Systems & Technologies Pvt Ltd
Lulu Cyber Tower 2 , 11th Floor, Infopark , Kochi
www.emsyne.com - +91 9995728766 || 8848605150
--
This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies and the original message. Any
unauthorized review, use, disclosure,dissemination, forwarding, printing or
copying of this email or any action taken in reliance on this e-mail is
strictly prohibited and may be unlawful. The recipient acknowledges that
Muthoot Finance Ltd or its subsidiaries and associated
companies(collectively "The Muthoot Group"),are unable to exercise control
or ensure or guarantee the integrity of/over the contents of the
information contained in e-mail transmissions and further acknowledges that
any views expressed in this message are those of the individual sender and
no binding nature of the message shall be implied or assumed unless the
sender does so expressly with due authority of Muthoot Finance Ltd. Before
opening any attachments please check them for viruses and defects.Virus
Warning: Although the company has taken reasonable precautions to ensure no
viruses are present in this email. The company cannot accept responsibility
for any loss or damage arising from the use of this email or attachment.
|
Install plugin and data fetched to dashboard successfully but getting exception when tried to call Wiredash.of(context).show();
Version 2.1.0
The text was updated successfully, but these errors were encountered: