GoToPage function

Future<String> GoToPage(
  1. dynamic page,
  2. dynamic title,
  3. dynamic context
)

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');
  }
}