ip_localizacao 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 53

Package para recuperação das informações do IP Externo (https://ipinfo.io/).

Uso #

Um simples exemplo de uso:

import 'package:ip_location/ip_location.dart';

main() async {
  var IP = new ip_location();

  var result = await IP.ReadIP();

  // Sucesso
  if (IP.getResponse() == 200) {
    print('IP Externo: '+IP.getIP());
  } else {
    print('Código de Retorno: '+IP.getResponse().toString());
    print('Erro: '+IP.getBody());

Recursos #

ReadIP - Método que realiza a consulta da localização do IP Externo.


getBody(); // Retorna na integralidade a resposta da API.
getResponse(); // Retorna o código da consulta a API (Padrão 200 para sucesso).

Quando houver sucesso (código 200) os métodos abaixo trazem retorno, do contrário retornam null;

getIP(); // Recupera o IP Externo (formatado).     

Funcionalidades e Bugs #

Por favor para requisições de funcionalidades e bugs issue tracker.

1.0.0 #

  • Versão inicial, desenvolvido por Mateus Penha.


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

main() async {
  var IP = new ip_localizacao.ip_localizacao();

  var result = await IP.ReadIP('');

  // Sucesso
  if (IP.getResponse() == 200) {
    print('IP: '+IP.getIP());
    print('Hostname: '+IP.getHostname());
    print('Cidade: '+IP.getCity());
    print('Região/Estado: '+IP.getRegion());
    print('País: '+IP.getCountry());
    print('País (Sigla 2): '+IP.getCountry2());
    print('País (Sigla 3): '+IP.getCountry3());
    print('Coordenadas: '+IP.getCoordinates());
    print('Código Postal: '+IP.getPostal());
    print('Provedor: '+IP.getOrg());
  } else {
    print('Código de Retorno: '+IP.getResponse().toString());
    print('Erro: '+IP.getBody());

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  ip_localizacao: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:ip_localizacao/ip_localizacao.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 8, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health issues and suggestions

Document public APIs. (-1 points)

17 out of 17 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/ip_localizacao_base.dart. (-1 points)

Analysis of lib/src/ip_localizacao_base.dart reported 2 hints:

line 9 col 10: The value of the field '_LastIP' isn't used.

line 61 col 9: DO use curly braces for all flow control structures.

Format lib/ip_localizacao.dart.

Run dartfmt to format lib/ip_localizacao.dart.

Maintenance suggestions

Package is getting outdated. (-14.52 points)

The package was last published 59 weeks ago.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
http ^0.12.0+1 0.12.0+4
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.12
http_parser 3.1.4
meta 1.1.8
path 1.6.4
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
pedantic ^1.0.0 1.9.0
test ^1.0.0