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

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published