Skip to content

GetX + Dio + EasyLocalization + HugeIcons: Naming Conflicts, Strict Inference, and Import Path Bugs #37

@codebyforam

Description

@codebyforam

Configuration Used

  • Architecture: Clean Architecture & Feature-first structure
    • State Management: GetX, GetX Routing, GetX Bindings
      • Networking: Dio
        • Icons: HugeIcons
          • Localization: easy_localization (default-bundled)

Description of Issues Found

1. Ambiguous Exports and Naming Conflicts

When packages_imports.dart exports package:get/get.dart (or when sub-packages are exported alongside dio and easy_localization), name collisions occur:

  • BuildContext Extension Collision (theme property): Both GetX's navigation extension (ContextExtensionss) and the custom generated ContextExtension in lib/src/extensions/context_extension.dart define theme.
    • String Extension Collision (tr method): Both GetX's translation extension (Trans) and easy_localization's extension (StringTranslateExtension) define the tr() method.
      • Class Collisions: FormData, MultipartFile, and Response are defined in both package:dio/dio.dart and package:get/get.dart (via its HTTP module).
        Fix: Update the GetX export statement in lib/src/imports/packages_imports.dart to:
export 'package:get/get.dart' hide ContextExtensionss, Trans, StringExtension, FormData, MultipartFile, Response;

2. Invalid Import Paths for AuthController

The generated screens and binding files attempt to import AuthController from controllers/auth_controller.dart, but the file is generated in the providers directory:

  • Correct path: package:atmadarshan/src/features/auth/presentation/providers/auth_controller.dart
    • Generated import: package:atmadarshan/src/features/auth/presentation/controllers/auth_controller.dart
      This causes compilation failures in:
  • lib/src/features/auth/presentation/screens/signup_screen.dart
    • lib/src/features/auth/presentation/screens/login_screen.dart
      • lib/src/features/auth/presentation/screens/forgot_password_screen.dart
        • lib/src/routing/app_bindings.dart
          Fix: Change the generated imports to point to providers/.

3. Strict Type Inference Warnings

With strict analysis options enabled, calling GetX navigation methods without specifying explicit type parameters raises warnings because the return types cannot be inferred.

Fix: Add explicit <dynamic> type arguments:

Get.toNamed<dynamic>(AppRoutes.forgotPassword);
Get.offAllNamed<dynamic>(AppRoutes.home);

And GetPage<dynamic> type arguments for AppRouter.getPages.

4. HugeIcons Rendering and Type Mismatch

  • AppIcon in lib/src/shared/widgets/app_icon.dart is typed as accepting IconData, but layouts pass HugeIcons.strokeRoundedHome01 which has a type of List<List<dynamic>>.
    • The generator outputs HugeIcons.strokeRoundedTickCircle in show_toast.dart, which does not exist in hugeicons: ^1.1.5 (the correct name is HugeIcons.strokeRoundedCheckmarkCircle01).
      Fix: Update AppIcon to accept dynamic and dynamically render either standard Icon or HugeIcon.

5. Missing Configuration Assets in pubspec.yaml

pubspec.yaml registers .env and assets/images/ as assets, but they are not created by default.

Fix: The generator should output an empty .env file and create the assets/images/ directory with a .gitkeep placeholder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions