Skip to content

A Dart package leverages the IP-API.com service to provide geolocation data based on IP addresses.

License

Notifications You must be signed in to change notification settings

elrizwiraswara/geolocation_ip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geolocation_ip

A Dart package leverages the IP-API.com service to provide geolocation data based on IP addresses. This package allows developers to easily integrate IP-based geolocation into their Dart or Flutter applications. It supports fetching detailed location information such as country, region, city, latitude, longitude, and more, without requiring an API key for non-commercial use.

Installation

Add the following to your pubspec.yaml file:

dependencies:
  geolocation_ip: ^0.0.3

Then run flutter pub get to install the package.

Usage

Basic Usage

import 'package:geolocation_ip/geolocation_ip.dart';

...
Future<void> getLocationInfo() async {
  String ip = '24.48.0.1';
  
  LocationInfo? locationInfo = await GeolocationIP.getInfo(ip, lang: Lang.en);

  print(locationInfo?.toJson());
  
  info = locationInfo;
  setState(() {});
}
...

About

A Dart package leverages the IP-API.com service to provide geolocation data based on IP addresses.

Topics

Resources

License

Stars

Watchers

Forks

Languages