nero-angela · GitHub

Reproduce

  1. Turn on the fix all option when saving in VSCode.
  2. Create the main.dart file and sub.dart file using dart’s part & part of syntax 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.
          ],
        );
      }
    }
  3. Even if you save in the sub.dart file, fix all does not work, so const is not added before SizedBox().
  4. If you save in the main.dart file, 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().

Video

2023-10-25.1.09.45.mov

Read the original on github.com ↗