geo-smart-app/lib/service/unique_id_service.dart

18 lines
419 B
Dart
Raw Permalink Normal View History

2019-12-16 00:18:09 +00:00
import 'package:dio/dio.dart';
import 'package:geosmart/model/unique_id_model.dart';
2019-12-16 00:18:09 +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
}
}
}