How to nest auto generated Dart files in IntelliJ Idea?

Issue

Minimal reproducible code:

// foo.dart
import 'package:json_annotation/json_annotation.dart';
part 'foo.g.dart';

@JsonSerializable()
class Foo {}

When I run

$ dart pub run build_runner build

It generates a foo.g.dart file in the same directory. But how can I combine/nest/merge/hide*/whatever this file with the original foo.dart file so that I don’t get to see the generated file (or at least without having to click an arrow button)

enter image description here

*hide: in a way it can be accessed when clicked from other code.

Solution

You can set up the file nesting rules accordingly:

enter image description here

Answered By – lena

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *