zino-hofmann / graphql-flutter

A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package.
https://zino-hofmann.github.io/graphql-flutter
MIT License
3.25k stars 622 forks source link

No getting response in WhenData #1359

Open tjbaba2 opened 1 year ago

tjbaba2 commented 1 year ago

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