avoid-bottom-type-in-records
Warns when a record type declaration contains fields with void
, Never
or Null
.
Presence of these types inside a record is most likely a bug.
Example
❌ Bad:
typedef NullableRecord = ({String str, void hello}); // LINT
(Null, int) nullable() => (null, 1); // LINT
(void hell, Never never) function() => (null, null); // LINT
✅ Good:
typedef NullableRecord = ({String str, Future<void> hello});
(int?, int) nullable() => (null, 1);
(String, int) correct() => ('str', 1);