login method

Future<Authentication> login(
  1. String user,
  2. String password
)

Implementation

Future<Authentication> login(String user, String password) async {
  Map<String, String> body = {'user': user, 'password': password};
  http.Response response = await _httpService.post(
    '/api/v1/login',
    jsonEncode(body),
    null,
  );

  if (response.statusCode == 200 && response.body.isNotEmpty == true) {
    return Authentication.fromMap(jsonDecode(response.body));
  }
  throw RocketChatException(response.body);
}