auto_route_library icon indicating copy to clipboard operation
auto_route_library copied to clipboard

Unhandled Exception: type 'AutoRoutePage<dynamic>' is not a subtype of type 'AutoRoutePage<Object>' in type

Open maheshmesta opened this issue 1 year ago • 2 comments

Exception

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'AutoRoutePage<dynamic>' is not a subtype of type 'AutoRoutePage<Object>' in type cast
#0      StackRouter._addEntry (package:auto_route/src/router/controller/routing_controller.dart:1552:18)
#1      StackRouter._pushAllGuarded (package:auto_route/src/router/controller/routing_controller.dart:1522:29)
<asynchronous suspension>

there is some exceptions i am getting in flutter windows. it seems like coming from package plz look into this.

[√] Flutter (Channel stable, 3.16.0, on Microsoft Windows [Version 10.0.22621.2861], locale en-IN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.3.2)
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.85.1)
[√] Connected device (3 available)
[√] Network resources

maheshmesta avatar Jan 02 '24 13:01 maheshmesta

Have the same problem when trying to return a result from a route.

I have added types everywhere as recommended but it still gets an error:

Unhandled Exception: type 'AutoRoutePage<dynamic>' is not a subtype of type 'AutoRoutePage<MyCustomType>'

eshfield avatar Jan 11 '24 20:01 eshfield

any solution here?

oengmengthong avatar Jan 19 '24 04:01 oengmengthong

The same problem Version auto_route: 7.8.4

filak8 avatar Mar 27 '24 11:03 filak8

@filak8 @eshfield have you added return type to @<RETURN_TYPE>RoutePage()

Milad-Akarie avatar Mar 27 '24 13:03 Milad-Akarie

@filak8 @eshfield have you added return type to @<RETURN_TYPE>RoutePage()

No( This was solution for me. Sorry for wasting your time.

filak8 avatar Mar 27 '24 14:03 filak8

@filak8 @eshfield have you added return type to @<RETURN_TYPE>RoutePage()

Thanks a lot! This code example did the trick:

@RoutePage<bool>()
class LoginPage extends StatelessWidget {}

eshfield avatar Apr 25 '24 14:04 eshfield