ip_localizacao 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 52

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 packages get

Alternatively, your editor might support pub get or flutter packages 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';
  
Version Uploaded Documentation Archive
1.0.0 Feb 14, 2019 Go to the documentation of ip_localizacao 1.0.0 Download ip_localizacao 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
4
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
52
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14

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. (-0.50 points)

Analysis of lib/src/ip_localizacao_base.dart reported 1 hint:

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

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+1
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.7
path 1.6.2
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
pedantic ^1.0.0
test ^1.0.0