Skip to content

Don't require "part file.*.dart" for files in the same directory with the same base name. #60018

Open
@tylandercasper

Description

@tylandercasper

The problem is that having to manually add "part 'file.g.dart';" to get code generators to work is error prone, confusing and adds even more boiler plate to a simple file.

A similar issue: #60016 got shot down because having to scan every file to see if it's linked to another file would be to expensive.

A good compromise would be to keep the part directive for arbitrary files, but also treating any group of files with a common basename in the same directory as a single shared library. (Basically implicit 'part file')

so
basename.dart
basename.g.dart
basename.freezed.dart
basename.customusercode.dart

would automatically be processed the same as if
basename.dart had "part ..." for each of the extra files.

This gives us the advantage of cleaned up code, but also doesn't add any extra processing time to build runner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions