Skip to main content


added in: 1.5.0
Dart 3.0+

Warns when a record type declaration contains a function type.

Records are usually treated as a way to group data, not behavior. Consider passing an instance of a class instead.


❌ Bad:

(String, void Function()) regular() => ('str', () {}); // LINT

({void Function() f}) named() => (f: () {},); // LINT

typedef NullableRecord = ({String str, int Function() f}); // LINT

✅ Good:

class WithBehavior {}

WithBehavior regular() => WithBehavior(...);

typedef NullableRecord = ({String str, int executionResult});