getServerInfo method

Future<Map<String, dynamic>> getServerInfo(
  1. String host
)

Fetches the server information from Dynamic Web TWAIN Service.

host - The host server URL.

Returns a Map<String, dynamic> containing the server information.

Implementation

Future<Map<String, dynamic>> getServerInfo(String host) async {
  final url = '$host/api/server/version';
  try {
    final response = await http.get(Uri.parse(url));
    return json.decode(response.body);
  } catch (e) {
    return {'version': e.toString(), 'compatible': false};
  }
}