Repository navigation
Closed
flutter/packages
#2395Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Steps to Reproduce
- Defines the Enhanced-enum that is now available in Dart 2.17.
enum Fruit {
apple(themeColor: Colors.red),
banana(themeColor: Colors.yellow),
orange(themeColor: Colors.orange),
;
const Fruit({required this.themeColor});
final Color themeColor;
}- Define a TypedGoRoute that takes Fruit as an argument.
@TypedGoRoute<FruitRoute>(
path: '/:fruit',
)
class FruitRoute extends GoRouteData {
const FruitRoute({required this.fruit});
final Fruit fruit;
@override
Widget build(BuildContext context) => const FruitPage();
}- Perform code generation.
flutter pub run build_runner build - Build the application.
- An error is displayed in the console and the build fails.
: Error: Member not found: 'themeColor'.
lib/…/router/app_routes.g.dart:204
Fruit.themeColor: 'theme-color',
^^^^^^^^^^It seems that go_router_builder also recognizes Enhanced-enum fields (themeColor in the example) as an value of Enum.
Both go_router_builder and Enhanced-enum are great features and should be used together.
I will add any missing information.
Thank you!
Reacted by mono — Masayuki Ono, Kirk / Kazuki Tatai, Yamamoto Tatsuya and tatsubee / Shoryu Yamamoto
Reacted by Masahiro Aoki
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Type
Projects
- StatusShow more project fieldsDone
Activity
danagbemava-nc commentedon Jun 13, 2022
I see some errors when I generate the code with the enhanced enums.
Leaving this for further input from the team.
flutter analyze
Labeling as a proposal as this doesn't seem to be currently supported.
Project for easy repro
egrb.zip
github-actions commentedon Oct 3, 2022
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.