Skip to content

Parsing error when using double for defaultValue in JsonKey #43

@tinted-knight

Description

@tinted-knight

JsonKey double default value

Trying to run genq with double value JsonKey(defaultValue: 36.6). No issue though when using int JsonKey(defaultValue: 42)

import 'package:genq/genq.dart';

part 'data_class.genq.dart';

@Genq(json: true)
class DataClass with _$DataClass {
  factory DataClass({
    @JsonKey(defaultValue: 36.6) required double value,
  }) = _DataClass;
}

Output:

Error when parsing: bin/data_class.dart:8
>      @JsonKey(defaultValue: 36.6) required double value,
>                           ^
>  Unexpected token: COLON (`:`). Expected IDENTIFIER.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions