bughelp wanted
Repository metrics
- Stars
- (2,177 stars)
- PR merge metrics
- (PR metrics pending)
Description
Describe the bug freezed's code generation changes the type of fields defined with a typedef type:
In Isar, Id is defined as
/// Type to specify the id property of a collection.
typedef Id = int;
Related issue opened in Isar: https://github.com/isar/isar/issues/639
To Reproduce
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:isar/isar.dart';
part 'order.freezed.dart';
part 'order.g.dart';
@Freezed(makeCollectionsUnmodifiable: false)
@Collection(ignore: {'copyWith'})
class Order with _$Order {
factory Order({
Id? localId,
required String id,
}) = _Order;
factory Order.fromJson(Map<String, dynamic> json) => _$OrderFromJson(json);
}
order.freezed.dart:
/// @nodoc
mixin _$Order {
int? get localId => throw _privateConstructorUsedError;
Expected behavior
I'd expect freezed to pass the type Id to the generated class instead of passing int.
Using: freezed: ^2.1.0+1 freezed_annotation: ^2.1.0
isar: 3.0.0-dev.14 isar_flutter_libs: 3.0.0-dev.14 isar_generator: 3.0.0-dev.14