Freezed: DiagnosticableTreeMixin related code still generated when foundation.dart is not imported

Created on 29 Jun 2020  路  3Comments  路  Source: rrousselGit/freezed

I have this freezed class which uses TimeOfDay from material library.

import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'time_slot.freezed.dart';

@freezed
abstract class TimeSlot with _$TimeSlot {
  factory TimeSlot({
    TimeOfDay start,
    TimeOfDay end,
  }) = _TimeSlot;
}

The generated class still contains DiagnosticableTreeMixin even though I didn't add import for flutter/foundation.dart, thus making a compile error.

Freezed version is 0.10.9

bug good first issue

All 3 comments

Probably an issue with the logic that determines if "foundations" is imported.

Fancy making a PR? Shouldn't be too difficult, but I have other things to do.

I have no experience dealing with code generation but I'll see what I can do.

Same issue here. I had to manual import foundation within the freezed class.

Was this page helpful?
0 / 5 - 0 ratings