Open
Description
Here are the models:
/// [UserProfile] model
@freezed
@ReactiveFormAnnotation()
@FormGroupAnnotation()
class UserProfile with _$UserProfile, BaseUser, NexusElement {
const factory UserProfile({
required String id,
@RfControl(validators: [RequiredValidator()]) required String name,
required UserProfileType type,
}) = _UserProfile;
/// Serialization
factory UserProfile.fromJson(Map<String, dynamic> json) => _$UserProfileFromJson(json);
}
@ReactiveFormAnnotation()
@FormGroupAnnotation()
class UserProfileType {
UserProfileType({
@FormArrayAnnotation() required this.permissions,
@FormControlAnnotation() required this.value,
});
final List<PermissionEntity> permissions;
final int value;
}
@ReactiveFormAnnotation()
@FormGroupAnnotation()
class PermissionEntity {
PermissionEntity({
@FormControlAnnotation() required this.permission,
@FormControlAnnotation() required this.value,
});
final ProfilePermissionsEnum permission;
final bool value;
}
The problem is that the PermissionEntity
is being created as a FormControl<Map<String, Object?>>
and it won't read it as a FormGroup
. Unless I'm doing something wrong, I think there's something bad happening.
I have used FormArrays
as FormGroup
s and indeed it read it as FormControl<Map<String, Object?>>
but it works if I just cast it as FormGroup
maybe a cast is missing when getting the value.
Metadata
Metadata
Assignees
Labels
No labels