avoid-function-type-in-records
added in: 1.5.0
warning
Dart 3.0Warns 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.
Example
❌ 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});