Giter VIP home page Giter VIP logo

current_location's Introduction

SimpleInAppWebView

Android IOS
Requirement min 16+ min 9.0

Getting Started

This package get the user current Location details. The returned data are the following:

Location({
    this.country,
    this.countryCode,
    this.region,
    this.regionName,
    this.timezone,
    this.latitude,
    this.longitude,
    this.isp,
    this.currentIP,
});

Demo:

demo

How to use?

  1. Installation Add current_location to pubspec.yaml, and hit command flutter pub get. or run flutter pub add current_location

    dependencies:
      current_location: any
  2. Implementation Before implementing, make sure you uderstand the parameters.

Location({
    this.country,
    this.countryCode,
    this.region,
    this.regionName,
    this.timezone,
    this.latitude,
    this.longitude,
    this.isp,
    this.currentIP,
});
  import 'package:current_location/current_location.dart';

Example of calling the function into a widget:

FutureBuilder(
    future: UserLocation.getValue(),
    builder: (BuildContext context, dynamic snapshot) {
        if (snapshot.hasData) {
            return Center(
                child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                        Text('Country: ${snapshot.data!.country}'),
                        Text('Country Code: ${snapshot.data!.countryCode}'),
                        Text('Region: ${snapshot.data!.region}'),
                        Text('Region Name: ${snapshot.data!.regionName}'),
                        Text('Timezone: ${snapshot.data!.timezone}'),
                        Text('Latitude: ${snapshot.data!.latitude}'),
                        Text('Longitude: ${snapshot.data!.longitude}'),
                        Text('ISP: ${snapshot.data!.isp}'),
                        Text('Current IP: ${snapshot.data!.currentIP}'),
                    ],
                ),
            );
        }
        
        return const CircularProgressIndicator();
    },
),

Example of returning it raw:

UserLocation.getValue().then((value) => print(value?.{REPLACE_THIS_OBJECT}));

or

late final UserLocation userLocation =  await UserLocation.getValue();

print(userLocation.country!);
print(userLocation.{REPLACE_THIS_OBJECT}!)

Contribution:

I Would ❤️ to see any contributions. If you do liked my work, show some ❤️ by ⭐ repo. 我愿意❤️ 查看任何贡献。如果你真的喜欢我的作品,展示一下❤️ 通过⭐ 回购。

current_location's People

Contributors

cherho0 avatar ctkqiang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.