File tree 3 files changed +8
-9
lines changed
geolocator_platform_interface
3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 1
1
/// Describes the current state of the location service on the native platform.
2
2
enum ServiceStatus {
3
- /// Indicates that the location service on the native platform is enabled.
4
- enabled,
5
-
6
3
/// Indicates that the location service on the native platform is enabled.
7
4
disabled,
5
+ /// Indicates that the location service on the native platform is enabled.
6
+ enabled,
8
7
}
Original file line number Diff line number Diff line change 1
1
import 'dart:async' ;
2
2
3
+ import 'package:flutter/cupertino.dart' ;
3
4
import 'package:flutter/services.dart' ;
4
5
5
6
import '../../geolocator_platform_interface.dart' ;
@@ -136,8 +137,7 @@ class MethodChannelGeolocator extends GeolocatorPlatform {
136
137
_serviceStatusEventChannel.receiveBroadcastStream ();
137
138
138
139
_serviceStatusStream = serviceStatusStream
139
- .map ((dynamic element) =>
140
- element as bool ? ServiceStatus .enabled : ServiceStatus .disabled)
140
+ .map ((dynamic element) => ServiceStatus .values[element as int ])
141
141
.handleError ((error) {
142
142
_serviceStatusStream = null ;
143
143
if (error is PlatformException ) {
Original file line number Diff line number Diff line change @@ -583,7 +583,7 @@ void main() {
583
583
'Should receive a stream with location service updates if permissions are granted' ,
584
584
() async {
585
585
// Arrange
586
- final streamController = StreamController <bool >.broadcast ();
586
+ final streamController = StreamController <int >.broadcast ();
587
587
EventChannelMock (
588
588
channelName: 'flutter.baseflow.com/geolocator_service_updates' ,
589
589
stream: streamController.stream);
@@ -594,12 +594,12 @@ void main() {
594
594
final streamQueue = StreamQueue (locationServiceStream);
595
595
596
596
// Emit test events
597
- streamController.add (true );
598
- streamController.add (false );
597
+ streamController.add (0 ); // disabled value in native enum
598
+ streamController.add (1 ); // enabled value in native enum
599
599
600
600
//Assert
601
- expect (await streamQueue.next, ServiceStatus .enabled);
602
601
expect (await streamQueue.next, ServiceStatus .disabled);
602
+ expect (await streamQueue.next, ServiceStatus .enabled);
603
603
604
604
// Clean up
605
605
await streamQueue.cancel ();
You can’t perform that action at this time.
0 commit comments