I create a login page. in that page if userId and password is incorrect, then it will show toast or snackbar.
though i tried myself, but i don't know, how to check my userid and password is correct or incorrect based on api?

\*\*here is login button \*\*

```
child: RaisedButton(
                  child: Text('Login'),
                  onPressed: () {
                    String _email = _emailController.text.trim();
                    String _password = _passwordController.text.trim();
                    setState(() {
                      _futureAlbum = createAlbum(
                          _emailController.text, 
                          _passwordController.text);
                    });
                       if(){
                       // in this section i want to check email id and password comparing from api request
                           }

                  },
                  color: Colors.green,
                  textColor: Colors.white,
                  padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
                ),

```

**Here is Api Request**

```
Future<Album> createAlbum(String employee_custom_id, String password) async {
    final response = await http.post(
      Uri.parse('https://portal-api.jomakhata.com/api/auth/login'),
      headers: <String, String>{
        'Content-Type': 'application/json',
      },
      body: jsonEncode(<String, String>{
        'employee_custom_id': employee_custom_id,
        'password': password,
      }),
    );
    final data = json.decode(response.body);
    if (response.statusCode == 200) {
      saveToken(data);
      Navigator.of(context).pushAndRemoveUntil(
          MaterialPageRoute(builder: (BuildContext context) => Main()),
          (Route<dynamic> route) => false);
      log('$data');
      return Album.fromJson(jsonDecode(response.body));
    } else {
      throw Exception('Failed to create album.');
    }
  }

```

**this is api response**

```
{token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjI5MDAsImlzcyI6Imh0dHBzOi8vcG9ydGFsLWFwaS5qb21ha2hhdGEuY29tL2FwaS9hdXRoL2xvZ2luIiwiaWF0IjoxNjMwNjk4MTY3LCJ..., message: success, userId: 2900, passwordChanged: yes}

```