Reproduce
- Turn on the fix all option when saving in VSCode.
- Create the
main.dartfile andsub.dartfile using dart’spart&part ofsyntax as follows.- main.dart
import 'package:flutter/material.dart'; part 'sub.dart'; void main() { runApp(const Sub()); }
- sub.dart
part of 'main.dart'; class Sub extends StatelessWidget { const Sub({super.key}); @override Widget build(BuildContext context) { return Column( children: [ SizedBox(), /// 👈 Use 'const' with the constructor to improve performance. ], ); } }
- Even if you save in the
sub.dartfile, fix all does not work, soconstis not added beforeSizedBox(). - If you save in the
main.dartfile, fix all will work in the sub.dart file.
Expected
I think even if saved in the sub.dart file, const must be added in front of SizedBox().