auto_route_library
auto_route_library copied to clipboard
Issue "Error: Required named parameter 'type' must be provided." when deploying Flutter in Netlify
Hey @Milad-Akarie, this is a great package for managing route
Previously I managed to deploying flutter on netlify until yesterday it failed with error message:
"Error: Required named parameter 'type' must be provided. ?.routerReportsNewRouteInformation( "
this is deploy log on netlify
Strange this error is not appear when i run flutter in my devices / local browser
this is my dependencies for auto route package
dependencies:
auto_route: ^2.3.0
...
dependency_overrides:
meta: ^1.7.0
dev_dependencies:
auto_route_generator: ^2.3.0
build_runner: ^2.0.5
...
and this is my AppRouter.dart
@MaterialAutoRouter(
replaceInRouteName: 'Page,Route',
routes: <AutoRoute>[
///After modify/add new route, run "flutter packages pub run build_runner watch" in terminal to generate new route
///or Run "flutter packages pub run build_runner watch --delete-conflicting-outputs" when conflicting output detected
///Login
AutoRoute(page: LoginPage, path: "/login"),
///MainNavigationPage
AutoRoute(page: MainNavigationPage, guards: [AuthGuard], path: "/",
children: [
///Dashboard
AutoRoute(page: DashboardPage, path: "dashboard", initial: true),
///ITSP
AutoRoute(page: ItspCompanyPage, path: "itsp"),
AutoRoute(page: ItspRkuPage, path: "itsp/:companyName/rku/"),
AutoRoute(page: ItspRktPage, path: "itsp/:companyName/rku/:rkuYear/rkt/"),
AutoRoute(page: ItspRktDetailPage, path: "itsp/:companyName/rku/:rkuYear/rkt/:rktYear/"),
AutoRoute(page: ItspTallyAddPage, path: "itsp/:companyName/rku/:rkuYear/rkt/:rktYear/add"),
AutoRoute(page: ItspTallyUpdatePage, path: "itsp/:companyName/rku/:rkuYear/rkt/:rktYear/update/:tallyId"),
///Logging
AutoRoute(page: LoggingOverviewPage, path: "logging"),
AutoRoute(page: LoggingListPage, path: "logging/list"),
AutoRoute(page: LoggingAddPAge, path: "logging/list/add"),
AutoRoute(page: LoggingOverviewDetailPage, path: "logging/:companyId"),
///Template Form & List
AutoRoute(page: FormPage, path: "form"),
AutoRoute(page: ListPage, path: "list"),
///Redirect to Initial Route (Dashboard) if route name is not detected
RedirectRoute(path: '*', redirectTo: '')
]
),
],
)
class $AppRouter {}
is this error related with auto route package? do you have any suggestion about this error? thanks @Milad-Akarie
After many attempts, I found the problem, the error appears when Netlify update the flutter
my assumption that the latest update of flutter (or a new branch) that got pulled has a conflict with package autoroute
so the workaround is deleting "git pull" (so Netlify not updating flutter) in Netlify build command and redeploy site.
Build Command (Failed) :
if cd flutter; then git pull && cd ..; else git clone https://github.com/flutter/flutter.git; fi && flutter/bin/flutter config --enable-web && flutter/bin/flutter build web --release
Build Command (Success) :
if cd flutter; then cd ..; else git clone https://github.com/flutter/flutter.git; fi && flutter/bin/flutter config --enable-web && flutter/bin/flutter build web --release
Hello @RizaldiWiratama,
This is caused by flutter/flutter/pull/88122.
thanks @LefebvreIlyas for the info, so a new update of Widget "Router" Flutter makes package autoroute fails to compile?
is any workaround for package autoroute for that case ? @Milad-Akarie
You're welcome @RizaldiWiratama.
The break comes more precisely from the RouteInformationProvider
class. The package code must be adapted to be compatible.
At the moment, this change is only effective on master if I'm not mistaken, so a solution would be to switch to the beta or dev branch, or even stable, if you don't use anything new that is not yet available there (flutter channel [branch_name]
).
Anyone know what would be the fix on the code side for autoroute so I can change it even if it's locally? I can't move away from master on my current project.
Thank you
Anyone know what would be the fix on the code side for autoroute so I can change it even if it's locally? I can't move away from master on my current project.
Thank you
Answering to myself, looks like just adding type: RouteInformationReportingType.navigate,
on router/widgets/auto_router_delegate.dart
does the trick. Not sure if it's going to break something else, but at least I can keep working for now
I got the same error while using Snapcraft to package my flutter app. Changing to the stable worked for me.
Thanks
You're welcome @RizaldiWiratama.
The break comes more precisely from the
RouteInformationProvider
class. The package code must be adapted to be compatible.At the moment, this change is only effective on master if I'm not mistaken, so a solution would be to switch to the beta or dev branch, or even stable, if you don't use anything new that is not yet available there (
flutter channel [branch_name]
).
Beta does not work either. Only stable does.
Hey @jlubeck could you be more specific about :
Answering to myself, looks like just adding
type: RouteInformationReportingType.navigate,
onrouter/widgets/auto_router_delegate.dart
does the trick. Not sure if it's going to break something else, but at least I can keep working for now
I've tried to add type: RouteInformationReportingType.navigate,
like so :
static reportUrlChanged(BuildContext context, String url) {
Router.of(context)
.routeInformationProvider
?.routerReportsNewRouteInformation(
RouteInformation(
location: url,
),
type: RouteInformationReportingType.navigate, // added line
);
}
But it didn't change anything in the error it produces.
Hey @jlubeck could you be more specific about :
Answering to myself, looks like just adding
type: RouteInformationReportingType.navigate,
onrouter/widgets/auto_router_delegate.dart
does the trick. Not sure if it's going to break something else, but at least I can keep working for nowI've tried to add
type: RouteInformationReportingType.navigate,
like so :static reportUrlChanged(BuildContext context, String url) { Router.of(context) .routeInformationProvider ?.routerReportsNewRouteInformation( RouteInformation( location: url, ), type: RouteInformationReportingType.navigate, // added line ); }
But it didn't change anything in the error it produces.
That's exactly what I did, not sure why it's not working for you :(
You can use this fork for now https://github.com/biklas7/auto_route_library/tree/chore/update-flutter-beta it's been working for me with the latest flutter beta version.
The solution for me was to set up my netlify.toml to this:
[build] publish = "build/web"
command = "if cd flutter; then cd ..; else git clone https://github.com/flutter/flutter.git; fi && flutter/bin/flutter config --enable-web && flutter/bin/flutter channel stable && flutter/bin/flutter build web --release"
Hey @jlubeck could you be more specific about :
Answering to myself, looks like just adding
type: RouteInformationReportingType.navigate,
onrouter/widgets/auto_router_delegate.dart
does the trick. Not sure if it's going to break something else, but at least I can keep working for nowI've tried to add
type: RouteInformationReportingType.navigate,
like so :static reportUrlChanged(BuildContext context, String url) { Router.of(context) .routeInformationProvider ?.routerReportsNewRouteInformation( RouteInformation( location: url, ), type: RouteInformationReportingType.navigate, // added line ); }
But it didn't change anything in the error it produces.
Thank you guys, this help's me to solve the same problem, but in my case it was not enough
I also added a parameter: {required RouteInformationReportingType type}
in the file: auto_route-3.0.4/lib/src/router/provider/auto_route_information_provider.dart
@override
void routerReportsNewRouteInformation(RouteInformation routeInformation,
{required RouteInformationReportingType type ,bool isNavigation = true}) { //required RouteInformationReportingType type - added by Anton Lobanov
var replace = false;
if (routeInformation is AutoRouteInformation) {
replace = routeInformation.replace;
}
SystemNavigator.selectMultiEntryHistory();
SystemNavigator.routeInformationUpdated(
location: routeInformation.location!,
state: routeInformation.state,
replace: replace || !isNavigation,
);
_value = routeInformation;
}
now it's works properly.
You can use this fork for now https://github.com/biklas7/auto_route_library/tree/chore/update-flutter-beta it's been working for me with the latest flutter beta version.
@biklas7 How to use this folk in pubspec
Error on line 19, column 11: Invalid description in the "auto_route_generator" pubspec on the "auto_route" dependency: "../auto_route" is a relative path, but this isn't a local pubspec. ╷ 19 │ path: ../auto_route │ ^^^^^^^^^^^^^ ╵ pub get failed (65; ╵) exit code 65
I get the following error
@Hacker437 I use it like this:
dependencies:
auto_route: ^3.1.3
dependency_overrides:
auto_route:
git:
url: [email protected]:biklas7/auto_route_library.git
ref: chore/update-flutter-beta
path: auto_route
dev_dependencies:
auto_route_generator: ^3.1.0
@Hacker437 I use it like this:
dependencies: auto_route: ^3.1.3 dependency_overrides: auto_route: git: url: [email protected]:biklas7/auto_route_library.git ref: chore/update-flutter-beta path: auto_route dev_dependencies: auto_route_generator: ^3.1.0
Thank you
so, now it's also broken on stable channel (Flutter 2.8 released yesterday)
@Hacker437 I use it like this:
dependencies: auto_route: ^3.1.3 dependency_overrides: auto_route: git: url: [email protected]:biklas7/auto_route_library.git ref: chore/update-flutter-beta path: auto_route dev_dependencies: auto_route_generator: ^3.1.0
Interesting doesn't work for me.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Any ideas how to fix that?
Interesting doesn't work for me.
[email protected]: Permission denied (publickey). fatal: Could not read from remote repository.
Any ideas how to fix that?
The repo is public so it should work. Do you have git set up on your terminal? Maybe check this. 🤔
@Hacker437 I use it like this:
dependencies: auto_route: ^3.1.3 dependency_overrides: auto_route: git: url: [email protected]:biklas7/auto_route_library.git ref: chore/update-flutter-beta path: auto_route dev_dependencies: auto_route_generator: ^3.1.0
Interesting doesn't work for me.
[email protected]: Permission denied (publickey). fatal: Could not read from remote repository.
Any ideas how to fix that?
If you're trying to fix the stable 2.8 issue, it's a new one. There is a pull request waiting to be merged so the contributor made available an override to his repo:
dependency_overrides:
auto_route:
git:
url: https://github.com/Agondev/auto_route_library
path: auto_route
Sorry, don't remember the thread id. Edit: Actually, it's #841
Version 3.2.0 seems to solve this 🎉
Version 3.2.0 seems to solve this 🎉
I still fold the above case
Version 3.2.0 seems to solve this
it seems there are 5 downvotes on this claim ... and my team is one of them
Does anyone else have suggestions??
@dgaedcke
Does anyone else have suggestions??
Didn't try but I saw someone said that it worked after updating flutter version.
I was having the same issues from autoroute updating my flutter version solved the problem for me.
You're welcome to try it out and share with us the results, and don't forget to mention your Flutter version.
Updating to latest version solved it for me to.
I can confirm that using an M1 mac with a fresh set of tools, flutter 2.8.1, dart 1.15.1 and changing auto_route in your pubspec.yaml to exactly ^3.2.0 I'm able to build web, macos and ios successfully. thank you!
Running ^3.2.0 with flutter 2.10.2 fixes the issue for me.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions
@github-actions
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions