ip_localizacao 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 49

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.

gets

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.

example/ip_localizacao_example.dart

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

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

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

  // 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:


dependencies:
  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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

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

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:ip_localizacao/ip_localizacao.dart.

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
http ^0.12.0+1 0.12.0+2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
meta 1.1.8
path 1.6.4
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
pedantic ^1.0.0 1.8.0+1
test ^1.0.0