one_trust_geo_location 0.0.1 copy "one_trust_geo_location: ^0.0.1" to clipboard
one_trust_geo_location: ^0.0.1 copied to clipboard

discontinued
outdated

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);
}
0
likes
150
points
9
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

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.

Homepage

License

BSD-3-Clause (license)

Dependencies

collection, http, json_pro

More

Packages that depend on one_trust_geo_location