Skip to content

must_be_immutable and MockΒ #200

Open
@vitor-gyant

Description

@vitor-gyant

Hi,

With the latest flutter version from master I'm seeing this lint errors:

This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: Mock._givenName, Mock._givenHashCode, Mock._defaultResponsedart(must_be_immutable)

These are the classes involved here. Equatable is also marked with immutable macro.

class MockWrongTypeChatWidgetModel extends Mock implements ChatWidgetModel {}

abstract class ChatWidgetModel extends Equatable {
  /// Identifies the type of widget.
  ChatWidgetModelType get type;

  /// Unique identifier that allows to identify which models are added/removed.
  String get id;

  /// Boolean that indicates if the model was sent
  /// from the server or the client.
  bool get incoming;

  /// Boolean that indicates if the user could undo the previous response.
  bool get undoable;

  /// Returns one of [ChatWidgetInputType].
  ///
  /// Default implementation returns [ChatWidgetModelInputType.none].
  ChatWidgetModelInputType get inputType => ChatWidgetModelInputType.none;

  /// [Equatable] helper that retrieves the fields that will be used to compare.
  Iterable get equatableFields;

  @override
  List get props =>
      [id, type, incoming, undoable, inputType]..addAll(equatableFields);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onS2type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions