If some functionality was already extracted to a separate class it usually doesn't make sense keeping it the file of another class.
BAD
// parent.dart
class Parent extends StatelessWidget {
...
}
class _Child extends StatelessWidget {
...
}
GOOD
// parent.dart
import 'child.dart';
class Parent extends StatelessWidget {
...
}
// child.dart
class Child extends StatelessWidget {
...
}
There should also be a way to specify exceptions, e.g. T and State<T> should be allowed in the same file by default
GOOD
class SomeWidget extends StatefulWidget {
...
}
class _SomeWidgetState extends State<SomeWidget> {
...
}
If some functionality was already extracted to a separate class it usually doesn't make sense keeping it the file of another class.
BAD
GOOD
There should also be a way to specify exceptions, e.g.
TandState<T>should be allowed in the same file by defaultGOOD