one_trust_geo_location 1.0.0
one_trust_geo_location: ^1.0.0 copied to clipboard
A most easily usable Geo Location API wrapper in Dart. With this library, you can easily integrate your application with the Geo Location API made by OneTrust.
example/one_trust_geo_location_example.dart
// Copyright (c) 2021, Kato Shinya. All rights reserved.
// Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:one_trust_geo_location/one_trust_geo_location.dart' as location;
void main() async {
// It's very easy to call api with get function.
// It has no class so it's better to set alias 'location' like below.
final response = await location.get();
if (response.status.isNotOk) {
// Do something when it's client or server error.
if (response.status.isClientError) {
return;
} else if (response.status.isServerError) {
return;
} else {
return;
}
}
print(response.country);
print(response.latitude);
print(response.longitude);
}