mobx.dart
mobx.dart copied to clipboard
Invalid function arguments types in generated file
actual function
Future<dynamic> loginUserOTPApi( {required LoginRequest data, void Function()? onSuccess, void Function(String error)? onFailure}) { }
generated function
@override Future<dynamic> loginUserOTPApi( {required LoginRequest data, void Function() onSuccess, void Function(String) onFailure}) { final _$actionInfo = _$_AuthStoreActionController.startAction( name: '_AuthStore.loginUserOTPApi'); try { return super.loginUserOTPApi( data: data, onSuccess: onSuccess, onFailure: onFailure); } finally { _$_AuthStoreActionController.endAction(_$actionInfo); } }
This problem is still happening.
It is unable to convert a method that receives a nullable function (with some arguments in my case), for example in the refreshToken
function:
Future<bool> refreshToken({
VoidCallback? onSuccess,
void Function([
String? title,
String? content,
String? debugInfo,
])? onFail,
}) {
...
}
onFail
is a nullable function with some arguments and when I run the command to automatically generate the store, it generates it like this:
Future<bool> refreshToken(
{VoidCallback? onSuccess,
void Function([String?, String?, String?]) onFail})
instead of generating it like this:
Future<bool> refreshToken(
{VoidCallback? onSuccess,
void Function([String?, String?, String?])? onFail})
The difference is the question mark before the argument name "onFail". Please fix this.