Watch-IP

Use Watch-IP with Flutter and Dart

watch_ip_sdk (pub.dev, v0.1.2) wraps GET /v1/geo for Flutter apps and plain Dart, built on package:http rather than a standard-library-only client so it also works on Flutter web.

Install

Requires Dart 3.0+ / any current stable Flutter channel. Depends on package:http — a deliberate exception to the other SDKs' zero-dependency approach, since dart:io's HttpClient isn't available on Flutter web.

Flutter

flutter pub add watch_ip_sdk

Quick start

A Flutter web build running in an actual browser tab sends Origin correctly on its own. A native iOS/Android/desktop build, or plain Dart on a server, doesn't — pass origin explicitly there. This SDK only ever needs the publishable key; never embed a secret key in a shipped app.

Dart

import 'package:watch_ip_sdk/watch_ip_sdk.dart';

final client = WatchIP('wip_pub_xxxxxxxx');
final geo = await client.getGeo();

print('${geo.country} ${geo.city} ${geo.timezone}');

Error handling and timeouts

Every failure throws a WatchIPError with a status and a stable code. A request that doesn't complete within timeout throws one with code network_error.

Dart

try {
  final geo = await client.getGeo(timeout: const Duration(seconds: 5));
} on WatchIPError catch (e) {
  print('${e.code} ${e.status} ${e.message}');
}

What this SDK doesn't cover

This package only calls GET /v1/geo. There's no Dart client yet for IP lookup, email validation, or risk checks — call them with package:http directly from your own backend, never from the app itself, since those endpoints need a secret key. See the authentication guide.

Related pages