geo-smart-app/lib/provider/unique_id_provider.dart
2019-12-16 07:18:09 +07:00

23 lines
580 B
Dart

import 'package:dio/dio.dart';
import 'package:geo_app/model/setting.dart';
import 'package:geo_app/model/unique_id_model.dart';
class UniqueIDProvider {
final String _endpoint = "/id/get/unique";
final Dio _dio = Dio();
SettingModel _settingModel;
UniqueIDProvider(this._settingModel);
Future<UniqueIDModel> getUniqueID() async {
try {
Response response = await _dio.get(
this._settingModel.host + _endpoint,
);
return UniqueIDModel.fromJson(response.data);
} on DioError catch (e) {
return UniqueIDModel.error();
}
}
}