The Wayback Machine - http://web.archive.org/web/20201203103946/https://github.com/rrousselGit/freezed/issues/221
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overridden toString() is not called when flutter/foundation.dart imported #221

Open
skybur opened this issue Jun 29, 2020 · 0 comments
Open

Overridden toString() is not called when flutter/foundation.dart imported #221

skybur opened this issue Jun 29, 2020 · 0 comments

Comments

@skybur
Copy link

@skybur skybur commented Jun 29, 2020

I have this freezed class

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

part 'time_slot.freezed.dart';

@freezed
abstract class TimeSlot implements _$TimeSlot {
  const TimeSlot._();

  factory TimeSlot({
    String start,
    String end,
  }) = _TimeSlot;

  @override
  String toString() {
    return start + end;
  }
}

When I call toString() for TimeSlot object, the result is from DiagnosticableTreeMixin instead of the overridden toString().
The result is

_$_TimeSlot#9c939(type: TimeSlot, start: TimeOfDay(10:00), end: TimeOfDay(12:00))

instead of

TimeOfDay(10:00)TimeOfDay(12:00)

Freezed version is 0.10.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.