csplookup 0.9.6 copy "csplookup: ^0.9.6" to clipboard
csplookup: ^0.9.6 copied to clipboard

Dart client package for CSP Lookup API. Requires an API key from CSP platform.

example/example.dart

import 'package:csplookup/csplookup.dart' as csplookup;

void handleResponse(csplookup.LookupResponse response) {
	// call checkAPIError() to check for API errors (Limit reached, Invalid key, etc.)
	try {
		response.checkAPIError();
	} on csplookup.InvalidKeyException {
		print('api key is not valid');
		return;
		// All exceptions are avilable in exceptions file
	} catch(e) {
		print('exception: ' + e.toString());
		return;
	}

	var result = response.getResult();
	print(result);
	// Instance of LookupResult
	print(result.country.isoCode);
	// Country iso code
}

void main(List<String> arguments) async {
  var client = csplookup.LookupClient(apiKey: 'YOUR_API_KEY');
  client.ipLookup('1.1.1.1').then((response) => handleResponse(response));
}
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Dart client package for CSP Lookup API. Requires an API key from CSP platform.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

http

More

Packages that depend on csplookup