Skip to content

Add support for analyzer strong-mode #4

Description

@TristanPct

The generated code has errors if analysis_options.yaml is set with:

analyzer:
  strong-mode:
    implicit-casts: false
    implicit-dynamic: false

In generated code:

  @override
  PropertyMap<Driver> props(Driver instance) {
    return PropertyMap<Driver>({'name': instance.name});
  }

throws a Missing type arguments for map literal exception on the argument map.

Also:

  @override
  ClassValidator getClassValidator() {
    return ClassValidator<Car>(validators: [
      FieldMatchValidator(
          baseField: 'frontWheelCoverLeft', matchField: 'frontWheelCoverRight')
        ..affectedFields = ['frontWheelCoverLeft', 'frontWheelCoverRight']
        ..baseFieldMessage = carFieldMatchBaseFieldMessage,
      FieldMatchValidator(
          baseField: 'rearWheelCoverLeft', matchField: 'rearWheelCoverRight')
        ..affectedFields = ['rearWheelCoverLeft', 'rearWheelCoverRight']
        ..matchFieldMessage = carFieldMatchMatchFieldMessage
    ]);
  }

throws a Missing type arguments for generic type 'FieldMatchValidator' exception on FieldMatchValidator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions