validateSession static method

Future<ParseUser> validateSession(
  1. String token
)

validates and returns user if session token is valid else returns null

Implementation

static Future<ParseUser> validateSession(String token) async {
  // ignore: omit_local_variable_types
  final Map<String, String> tmpHead = {}
    ..addAll(_headers)
    ..['X-Parse-Session-Token'] = token;
  var response = await http.get('$_url/parse/users/me', headers: tmpHead);
  if (response.statusCode == 200) {
    return ParseUser._fromResponse(response);
  } else {
    return null;
  }
}