GoToPage function
Implementation
Future<String> GoToPage(page, title, context) async {
final response = await http.get(Uri.parse(
'https://pz0mwfkp5m.execute-api.us-east-1.amazonaws.com/dev/screen/content?id=$page'));
if (response.statusCode == 200) {
// If the server did return a 200 OK response,
// then parse the JSON.
SecondRoute r = SecondRoute();
r.definition = response.body;
r.title = title;
Navigator.push(
context,
MaterialPageRoute(builder: (context) => r),
);
return response.body;
} else {
// If the server did not return a 200 OK response,
// then throw an exception.
throw Exception('Failed to load album');
}
}