You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, sometimes the common type might not be accessible in the freezed file, which causes errors.
For example :
// In a library which only exports A, B and C and Common1 but doesn't export Common2classCommon1 {}
classCommon2extendsCommon1 {}
classAextendsCommon2{}
classBextendsCommon2{}
// In a different library that imports the library above@freezedclassMyUnionwith_$MyUnion {
constfactoryMyUnion.first(A param) =_First;
constfactoryMyUnion.second(B param) =_Second;
}
The generated getter is Common2 get param => throw _privateConstructorUsedError;, with an error Undefined class 'Common2'.
What should instead happen is skip the common type Common2, and pick instead Common1 which is higher in the class hierarchy but is accessible.
The text was updated successfully, but these errors were encountered:
rrousselGit
changed the title
Common properties nearest common type should be accessible
When the common type of a shared property is not accessible within the library, attempt again with an ancestor type
Feb 5, 2023
The feature introduced in #740 is great.
However, sometimes the common type might not be accessible in the freezed file, which causes errors.
For example :
The generated getter is
Common2 get param => throw _privateConstructorUsedError;
, with an errorUndefined class 'Common2'.
What should instead happen is skip the common type
Common2
, and pick insteadCommon1
which is higher in the class hierarchy but is accessible.The text was updated successfully, but these errors were encountered: