dart_mappable
dart_mappable copied to clipboard
[Bug] 2.0.0-dev.5: Mappable tries to import deleted files
Hi there again!
Try the following steps with 2.0.0-dev.5:
- Define an
abstract classand a concrete subclass of such class
// asd.dart
import 'package:dart_mappable/dart_mappable.dart';
import '../main.mapper.g.dart';
@MappableClass()
abstract class Asd with AsdMappable {
const Asd(this.id);
final String id;
}
@MappableClass()
class Something extends Asd with SomethingMappable {
const Something(super.id);
}
- Import this file in your
main.dartfile and generate code withbuild_runner watch. Everything works fine. - DELETE the file you've just created (
asd.dart) and delete its import in the main file - The import of
asd.dartstill persists inmain.mapper.g.dart, and it doesn't go away in the next code generations
It's really hard to make this broken import go away, and it does only after certain conditions, which I'm unsure of at this moment in time.
The only reliable way to force a full reset of the generated code is to interrupt watch, perform a pub get and then watch again