use-string-in-part-of-directives

Same as use_string_in_part_of_directives in Dart lints

Group
Style
Path
lint/style/use-string-in-part-of-directives
Default
On (recommended)
Origin
Dart lints
Rule
506 of 512
recommended

Flags a part of directive that names its library instead of using a string URI.

A part of my.library.name; directive identifies the enclosing library by its declared name, which forces the parent to carry a library name and couples the part to it indirectly. The URI form, part of 'parent.dart';, points straight at the containing file, is more robust, and is the form modern Dart tooling prefers. The rule reports only the named form (a non-empty dotted name with no string URI).

Invalid

example.dartdart
part of foo;
Use a string to refer to the containing library in a part-of directive.
1part of foo;

Valid

example.dartdart
part of 'main.dart';

Configure use-string-in-part-of-directives

Set its severity in falcon.json. See the configuration guide.

falcon.jsonjson
{
  "linter": {
    "rules": {
      "style": {
        "use-string-in-part-of-directives": "error"
      }
    }
  }
}

Or silence one occurrence with a suppression comment; the reason is required.

example.dartdart
// falcon-ignore lint/style/use-string-in-part-of-directives: <reason>