Closed easazade closed 3 years ago
this will fail:
import 'package:sealed_annotations/sealed_annotations.dart';
part 'state.sealed.dart';
@Sealed()
abstract class _State {
void one(void Function() x);
}
"SealedError{message={internal error},cause={check failed}}"
I think it's because of the internal checks I put on argument types which I didn't think of function types as valid types! 😢
this will fail for the same reson:
import 'package:sealed_annotations/sealed_annotations.dart';
part 'state.sealed.dart';
typedef void ABC();
@Sealed()
abstract class _State {
void one(ABC x);
}
for now you can use this workaround which won't fail:
import 'package:sealed_annotations/sealed_annotations.dart';
part 'state.sealed.dart';
typedef void ABC();
@Sealed()
abstract class _State {
void one(@WithType('ABC') x);
}
I think analyzer unwraps typedefs by default, but by using this workaround we are forcing dart_sealed to use typedef instead.
I should find a way to check functional types, then I can fix this issue. @easazade
@FatulM the solution worked fine
I've fixed this issue in 1.7.0
,
Now you should be able to use all functional types,
check for example:
functional.dart
@easazade @SaeedMasoumi
here is the code for the sealed class
and here is the error i get when running
build_runner
I tried different things found out whenever I use the type
VoidCallback
or a generic type that has that type likeConsumable<VoidCallback>
as the method argument, code generation fails