Skip to content
pubscout

get_country_ip

0.0.2, released 2 years ago by an unverified publisher

Fetch device's public IP and geolocation via background isolate.

WASM-ready
$ flutter pub add get_country_ip
Source repository

What it does

The package retrieves the user's public IP address and looks up its geolocation data such as country, region, city, and ISP. It performs the network request in a background isolate to keep the UI thread responsive.

AI-written summary of version 0.0.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • When you need to personalize content based on the user's location
  • When you want to log or analyze traffic by IP
  • When you need a lightweight IP-based geolocation solution

Skip it when

  • When the device is offline or the API is unreachable
  • When privacy concerns prevent sending the IP to an external service

Strengths

  • Runs network logic in a background isolate for smooth UI
  • Lightweight and easy to integrate
  • Provides comprehensive geolocation data

Weaknesses

  • Relies on an external API, no offline support
  • No built-in caching or retry logic
  • No privacy controls for IP exposure

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
import 'package:get_country_ip/get_country_ip.dart';

void fetchLocation() async {
  final ipService = GetCountryIp();
  final location = await ipService.getIPLocation();
  if (location != null) {
    print("Location Info: $location");
  } else {
    print("Failed to get location.");
  }
}

Alternatives

Packages that do the same job and could replace get_country_ip.

  • geoclue

    Dart client for the GeoClue D-Bus geolocation service on Linux.