loginResponse function Null safety

Future<Response> loginResponse(
  1. String username,
  2. String password
)

Returns the a http request of a JWT token for username.

Will return null if the requests fails.

Implementation

Future<http.Response> loginResponse(String username, String password) async {
  var unencodedPath = '/auth/login';
  var response = await http.post(
    Uri.https(authority, unencodedPath),
    headers: {'content-type': 'application/json'},
    body: jsonEncode(
      {'username': '$username', 'password': '$password'},
    ),
  );
  return response;
}