2019-12-16 00:18:09 +00:00
|
|
|
import 'package:dio/dio.dart';
|
2020-07-08 13:13:24 +00:00
|
|
|
import 'package:geosmart/model/unique_id_model.dart';
|
2019-12-16 00:18:09 +00:00
|
|
|
|
2020-07-08 13:13:24 +00:00
|
|
|
class UniqueIDService {
|
2019-12-16 00:18:09 +00:00
|
|
|
final String _endpoint = "/id/get/unique";
|
|
|
|
|
2020-07-28 18:11:47 +00:00
|
|
|
Future<UniqueIDModel> getUniqueID(String host, Dio dio) async {
|
2019-12-16 00:18:09 +00:00
|
|
|
try {
|
2020-07-28 18:11:47 +00:00
|
|
|
Response response = await dio.get(
|
|
|
|
host + _endpoint,
|
2019-12-16 00:18:09 +00:00
|
|
|
);
|
|
|
|
return UniqueIDModel.fromJson(response.data);
|
|
|
|
} on DioError catch (e) {
|
2020-07-28 18:11:47 +00:00
|
|
|
throw (e);
|
2019-12-16 00:18:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|