Skip to content

### 📦 Export Structure Issue: Use index.dart Files Instead of Direct File Exports #12

@ajaxspace

Description

@ajaxspace

Problem:
The current export structure lists individual files explicitly:

// Models
export 'models/agent.dart';
export 'core/models/agent.dart';

// Services
export 'core/services/auth_service.dart';

// Theme
export 'theme/app_colors.dart';
export 'theme/app_theme.dart';
export 'theme/app_dimensions.dart';

Issues:

  • Repetition and redundancy across export files
  • Difficult to scale and maintain as files grow
  • Hard to get a clear overview of module structure

Recommendation:
Group and re-export files using index.dart (barrel files) inside each folder. This improves organization and simplifies imports throughout the codebase.

✅ Suggested structure:

// models/index.dart
export 'agent.dart';

// core/models/index.dart
export 'agent.dart';

// core/services/index.dart
export 'auth_service.dart';

// theme/index.dart
export 'app_colors.dart';
export 'app_theme.dart';
export 'app_dimensions.dart';

Then update exports to:

export 'models/index.dart';
export 'core/models/index.dart';
export 'core/services/index.dart';
export 'theme/index.dart';

Optionally, rename index.dart to models.dart, services.dart, etc., for better IntelliSense and clarity.

Impact:

  • Cleaner and more maintainable module exports
  • Easier to refactor and scale codebase
  • Simplifies import paths in feature modules

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