Skip to content

Instantly share code, notes, and snippets.

View CarlosSantos27's full-sized avatar

Carlos Santos CarlosSantos27

View GitHub Profile
@darwin-morocho
darwin-morocho / geolocator_wrapper.dart
Last active September 2, 2022 12:25
Flutter - A class to wrap the static methods of the geolocator plugin, with this you can mock the wrapper for unit testing or widget testing
import 'dart:async';
import 'package:geolocator/geolocator.dart';
class GeolocatorWrapper {
StreamController<Position>? _positionController;
StreamController<bool>? _serviceEnabledController;
StreamSubscription? _positionSubscription, _serviceEnabledSubscription;
/// check if the Location Service is Enabled
Future<bool> get isLocationServiceEnabled => Geolocator.isLocationServiceEnabled();