I am trying to get my head around tuple for the first time using it in an async function. When testing I am not able to catch the response. I have been google the problem but not been able t solve it.
I want to run an async function that return three strings. I am not able to catch the response. Have tried referencing item or the name.
Here is the code:
var _moonAndSunResult = CleanSunAndMoonJson(_moonJson);
print(_moonAndSunResult);
Tried referencing the _moonAndSunResult in different ways.
// async Task<Tuple<string, string, string, string>> CleanSunAndMoonJson(string _json)
async Task<(string, string, string, string)> CleanSunAndMoonJson(string _json)
{
print("sunRise: " + GetCorrectTimeFormat("sunRise", _json));
print("sunSet: " + GetCorrectTimeFormat("sunSet", _json));
print("moonRise: " + GetCorrectTimeFormat("moonRise", _json));
print("moonSet: " + GetCorrectTimeFormat("moonSet", _json));
Utility.sunrise = GetCorrectTimeFormat("sunRise", _json);
Utility.sunset = GetCorrectTimeFormat("sunSet", _json);
Utility.moonrise = GetCorrectTimeFormat("moonRise", _json);
Utility.moonset = GetCorrectTimeFormat("moonSet", _json);
await Task.Yield();
//return (firstValue, secondValue, thirdValue);
//return new Tuple<string, string, string, string>(Utility.sunrise, Utility.sunset, Utility.moonrise, Utility.moonset);
return (Utility.sunrise, Utility.sunset, Utility.moonrise, Utility.moonset);
//return Tuple.Create(Utility.sunrise, Utility.sunset, Utility.moonrise, Utility.moonset);
}
I get this from the _moonAndSunResult print above
System.Threading.Tasks.Task`1[System.ValueTuple`4[System.String,System.String,System.String,System.String]]