When I generate the file as usual, it works fine. But when I add package:flutter/material.dart, the generated file has many error with DiagnosticableTreeMixin. This is the generated file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named
part of 'test_issues.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
class _$AuthFailureTearOff {
const _$AuthFailureTearOff();
ServerError serverError() {
return const ServerError();
}
}
// ignore: unused_element
const $AuthFailure = _$AuthFailureTearOff();
mixin _$AuthFailure {}
abstract class $AuthFailureCopyWith<$Res> {
factory $AuthFailureCopyWith(
AuthFailure value, $Res Function(AuthFailure) then) =
_$AuthFailureCopyWithImpl<$Res>;
}
class _$AuthFailureCopyWithImpl<$Res> implements $AuthFailureCopyWith<$Res> {
_$AuthFailureCopyWithImpl(this._value, this._then);
final AuthFailure _value;
// ignore: unused_field
final $Res Function(AuthFailure) _then;
}
abstract class $ServerErrorCopyWith<$Res> {
factory $ServerErrorCopyWith(
ServerError value, $Res Function(ServerError) then) =
_$ServerErrorCopyWithImpl<$Res>;
}
class _$ServerErrorCopyWithImpl<$Res> extends _$AuthFailureCopyWithImpl<$Res>
implements $ServerErrorCopyWith<$Res> {
_$ServerErrorCopyWithImpl(
ServerError _value, $Res Function(ServerError) _then)
: super(_value, (v) => _then(v as ServerError));
@override
ServerError get _value => super._value as ServerError;
}
class _$ServerError with DiagnosticableTreeMixin implements ServerError {
const _$ServerError();
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'AuthFailure.serverError()';
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties..add(DiagnosticsProperty('type', 'AuthFailure.serverError'));
}
@override
bool operator ==(dynamic other) {
return identical(this, other) || (other is ServerError);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class ServerError implements AuthFailure {
const factory ServerError() = _$ServerError;
}
I just add the import, nothing else.
Freezed detect that you are using Flutter. As such, it wants you to also import package:flutter/fundations.dart to make your objects dev-tool friendly
Oh right... Thanks... Closed now!
Most helpful comment
Freezed detect that you are using Flutter. As such, it wants you to also import
package:flutter/fundations.dartto make your objects dev-tool friendly