graphql-flutter
graphql-flutter copied to clipboard
No getting response in WhenData
I am using this provider
final saveTournamentFlightsProvider =
FutureProvider.family<Map<String, dynamic>, SaveFlightModel>((ref, saveFlights) async {
final mutation = ref.watch(saveTournamentFlightsMutation);
final data = await mutation.saveFlights(
saveFlights.tournamentId!,
saveFlights.flights!,
saveFlights.flightMembers,
);
ref
.read(uploadStatusProvider.notifier)
.updateStatus(data == null ? "Failed" : "Successful");
log('data $data');
return data?? "No Data";
});
the log is priniting the data on console but when i try to get this data on frontend like this.
final mutation = ref.watch(saveTournamentFlightsProvider(SaveFlightModel(
flightsToUpload, flights.first.tournamentId, flightMembers)));
mutation.whenData((value) => log('Data $value'));
i get noting, it doesn't even log anything.
Note: I am calling this provider ontap of a button, if i am doing wrong please help me, Thanks