Reputation: 381
Am trying to implement Workmanager in flutter code and need context inside the function.
void callbackDispatcher() {
Workmanager().executeTask((taskName, inputData) async {
await AuthController.refreshToken(context);
return Future.value(true);
});
}
The above code shows error in context and also tried
await AuthController.refreshToken(inputData?[context]);
This will shows an error --- BackgroundWorker(16318): errorCode: error, errorMessage: Null check operator used on a null value.
Anyone have any idea abuot this?
Upvotes: 0
Views: 934