auto_route: ^8.1.3
auto_route_generator: ^8.0.0
build_runner: ^2.4.11
Could someone point me how to exclude “key” argument from build_runner.
I try to create route with single required argument – storyName
@RoutePage()
class StoryView extends StatefulWidget {
const StoryView({super.key, @pathParam required this.storyName});
final String storyName;
@override
State<StoryView> createState() => _StoryViewState();
}
but after run – flutter packages pub run build_runner watch. Build runner create file auto_router.gr.dart with error:
Undefined class ‘Key’.
Try changing the name to the name of an existing class, or creating a class with the name ‘Key’
/// generated route for
/// [StoryView]
class StoryRoute extends PageRouteInfo<StoryRouteArgs> {
StoryRoute({
Key? key,
required String storyName,
List<PageRouteInfo>? children,
}) : super(
StoryRoute.name,
args: StoryRouteArgs(
key: key,
storyName: storyName,
),
rawPathParams: {'storyName': storyName},
initialChildren: children,
);
static const String name = 'StoryRoute';
static const PageInfo<StoryRouteArgs> page = PageInfo<StoryRouteArgs>(name);
}