From bd517c495382f81ed40ca0c52efe868e48658561 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Sun, 16 Nov 2025 19:08:52 -0700 Subject: [PATCH] flutter run -d chrome --- cmd/app/main.dart | 26 ------------- lib/main.dart | 64 +++++++++++++++++++++++++++++++ pubspec.yaml.todo => pubspec.yaml | 2 + 3 files changed, 66 insertions(+), 26 deletions(-) delete mode 100644 cmd/app/main.dart create mode 100644 lib/main.dart rename pubspec.yaml.todo => pubspec.yaml (52%) diff --git a/cmd/app/main.dart b/cmd/app/main.dart deleted file mode 100644 index 26fe10a..0000000 --- a/cmd/app/main.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:location/location.dart'; - -Location location = Location(); -location.enableBackgroundMode(enable: true) - -bool serviceEnabled; -PermissionStatus permissionGranted; -LocationData locationData; - -serviceEnabled = await location.serviceEnabled(); -if (!serviceEnabled) { - serviceEnabled = await location.requestService(); - if (!serviceEnabled) { - return; - } -} - -permissionGranted = await location.hasPermission(); -if (permissionGranted == PermissionStatus.denied) { - permissionGranted = await location.requestPermission(); - if (permissionGranted != PermissionStatus.granted) { - return; - } -} - -locationData = await location.getLocation(); diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..31defc0 --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,64 @@ +import 'package:location/location.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter/material.dart'; + +class Package {} + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: const Text('Home'), + ), + body: Center( + child: Builder( + builder: (context) { + return Column( + children: [ + const Text('Hello world'), + const SizedBox(height: 20), + //ElevatedButton() + ], + ) + }, + ), + ), + ), + ) + } +} + +void foo() async { + Location location = Location(); + location.enableBackgroundMode(enable: true) + + bool serviceEnabled; + PermissionStatus permissionGranted; + + serviceEnabled = await location.serviceEnabled(); + if (!serviceEnabled) { + serviceEnabled = await location.requestService(); + if (!serviceEnabled) { + return; + } + } + + permissionGranted = await location.hasPermission(); + if (permissionGranted == PermissionStatus.denied) { + permissionGranted = await location.requestPermission(); + if (permissionGranted != PermissionStatus.granted) { + return; + } + } + + final locationData = await location.getLocation(); + print(locationData); +} diff --git a/pubspec.yaml.todo b/pubspec.yaml similarity index 52% rename from pubspec.yaml.todo rename to pubspec.yaml index 980f0a9..f4ccb91 100644 --- a/pubspec.yaml.todo +++ b/pubspec.yaml @@ -1,2 +1,4 @@ +environment: + sdk: '^3.10.0' dependencies: location: ^5.0.0