handshake method

Future<void> handshake()

Performs a handshake with the Optimus API to verify the app.

Implementation

Future<void> handshake() async {
  final targetPath = '$handshakeUrl/$_appId';
  final response = await _client.get(Uri.https(_apiEndpoint, targetPath));
  final res = Response.fromJson(
    convert.jsonDecode(response.body) as Map<String, dynamic>,
  );

  if (response.statusCode != 200 || !res.success) {
    throw ClientException(
      res.message.isNotEmpty
          ? res.message
          : 'Something went wrong while trying to handshake with Optimus API',
      response.statusCode,
    );
  }
}