location2 6.0.1 copy "location2: ^6.0.1" to clipboard
location2: ^6.0.1 copied to clipboard

This library aims at providing you a simple way to get the user location without thinking about permission.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:location2_example/change_notification.dart';
import 'package:location2_example/change_settings.dart';
import 'package:location2_example/get_location.dart';
import 'package:location2_example/listen_location.dart';
import 'package:location2_example/permission_status.dart';
import 'package:location2_example/service_enabled.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Location',
      theme: ThemeData(
        primarySwatch: Colors.amber,
      ),
      home: const MyHomePage(title: 'Flutter Location Demo'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key, this.title});
  final String? title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title!),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: const <Widget>[
            SizedBox(height: 16),
            PermissionStatusWidget(),
            Divider(height: 32),
            ServiceEnabledWidget(),
            Divider(height: 32),
            GetLocationWidget(),
            Divider(height: 32),
            ListenLocationWidget(),
            Divider(height: 32),
            ChangeSettings(),
            Divider(height: 32),
            ChangeNotificationWidget()
          ],
        ),
      ),
    );
  }
}
4
likes
0
pub points
68%
popularity

Publisher

unverified uploader

This library aims at providing you a simple way to get the user location without thinking about permission.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, location2_android, location2_ios, location2_macos, location2_platform_interface, location2_web

More

Packages that depend on location2