Skip to content

Commit 0f3ff93

Browse files
committed
Fix formatting issues across codebase
1 parent 16ef887 commit 0f3ff93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3734
-3677
lines changed

geolocator/example/lib/main.dart

Lines changed: 151 additions & 165 deletions
Large diffs are not rendered by default.

geolocator/lib/geolocator.dart

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ class Geolocator {
5454
/// passing true to the [forceAndroidLocationManager] parameter. On iOS
5555
/// this parameter is ignored.
5656
/// When no position is available, null is returned.
57-
static Future<Position?> getLastKnownPosition(
58-
{bool forceAndroidLocationManager = false}) =>
59-
GeolocatorPlatform.instance.getLastKnownPosition(
60-
forceLocationManager: forceAndroidLocationManager);
57+
static Future<Position?> getLastKnownPosition({
58+
bool forceAndroidLocationManager = false,
59+
}) => GeolocatorPlatform.instance.getLastKnownPosition(
60+
forceLocationManager: forceAndroidLocationManager,
61+
);
6162

6263
/// Returns the current position.
6364
///
@@ -119,13 +120,16 @@ class Geolocator {
119120
static Future<Position> getCurrentPosition({
120121
LocationSettings? locationSettings,
121122
@Deprecated(
122-
"use settings parameter with AndroidSettings, AppleSettings, WebSettings, or LocationSettings")
123+
"use settings parameter with AndroidSettings, AppleSettings, WebSettings, or LocationSettings",
124+
)
123125
LocationAccuracy desiredAccuracy = LocationAccuracy.best,
124126
@Deprecated(
125-
"use settings parameter with AndroidSettings, AppleSettings, WebSettings, or LocationSettings")
127+
"use settings parameter with AndroidSettings, AppleSettings, WebSettings, or LocationSettings",
128+
)
126129
bool forceAndroidLocationManager = false,
127130
@Deprecated(
128-
"use settings parameter with AndroidSettings, AppleSettings, WebSettings, or LocationSettings")
131+
"use settings parameter with AndroidSettings, AppleSettings, WebSettings, or LocationSettings",
132+
)
129133
Duration? timeLimit,
130134
}) {
131135
LocationSettings? settings;
@@ -145,8 +149,9 @@ class Geolocator {
145149
timeLimit: timeLimit,
146150
);
147151

148-
return GeolocatorPlatform.instance
149-
.getCurrentPosition(locationSettings: settings);
152+
return GeolocatorPlatform.instance.getCurrentPosition(
153+
locationSettings: settings,
154+
);
150155
}
151156

152157
/// Fires whenever the location changes inside the bounds of the
@@ -187,10 +192,9 @@ class Geolocator {
187192
/// but the location services of the device are disabled.
188193
static Stream<Position> getPositionStream({
189194
LocationSettings? locationSettings,
190-
}) =>
191-
GeolocatorPlatform.instance.getPositionStream(
192-
locationSettings: locationSettings,
193-
);
195+
}) => GeolocatorPlatform.instance.getPositionStream(
196+
locationSettings: locationSettings,
197+
);
194198

195199
/// Returns a [Future] containing a [LocationAccuracyStatus]
196200
/// When the user has given permission for approximate location,
@@ -221,10 +225,9 @@ class Geolocator {
221225
/// using other platforms.
222226
static Future<LocationAccuracyStatus> requestTemporaryFullAccuracy({
223227
required String purposeKey,
224-
}) =>
225-
GeolocatorPlatform.instance.requestTemporaryFullAccuracy(
226-
purposeKey: purposeKey,
227-
);
228+
}) => GeolocatorPlatform.instance.requestTemporaryFullAccuracy(
229+
purposeKey: purposeKey,
230+
);
228231

229232
/// Opens the App settings page.
230233
///
@@ -251,13 +254,12 @@ class Geolocator {
251254
double startLongitude,
252255
double endLatitude,
253256
double endLongitude,
254-
) =>
255-
GeolocatorPlatform.instance.distanceBetween(
256-
startLatitude,
257-
startLongitude,
258-
endLatitude,
259-
endLongitude,
260-
);
257+
) => GeolocatorPlatform.instance.distanceBetween(
258+
startLatitude,
259+
startLongitude,
260+
endLatitude,
261+
endLongitude,
262+
);
261263

262264
/// Calculates the initial bearing between two points
263265
///
@@ -270,11 +272,10 @@ class Geolocator {
270272
double startLongitude,
271273
double endLatitude,
272274
double endLongitude,
273-
) =>
274-
GeolocatorPlatform.instance.bearingBetween(
275-
startLatitude,
276-
startLongitude,
277-
endLatitude,
278-
endLongitude,
279-
);
275+
) => GeolocatorPlatform.instance.bearingBetween(
276+
startLatitude,
277+
startLongitude,
278+
endLatitude,
279+
endLongitude,
280+
);
280281
}

geolocator/test/geolocator_test.dart

Lines changed: 38 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@ import 'package:mockito/mockito.dart';
55
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
66

77
Position get mockPosition => Position(
8-
latitude: 52.561270,
9-
longitude: 5.639382,
10-
timestamp: DateTime.fromMillisecondsSinceEpoch(
11-
500,
12-
isUtc: true,
13-
),
14-
altitude: 3000.0,
15-
altitudeAccuracy: 0.0,
16-
accuracy: 0.0,
17-
heading: 0.0,
18-
headingAccuracy: 0.0,
19-
speed: 0.0,
20-
speedAccuracy: 0.0);
8+
latitude: 52.561270,
9+
longitude: 5.639382,
10+
timestamp: DateTime.fromMillisecondsSinceEpoch(500, isUtc: true),
11+
altitude: 3000.0,
12+
altitudeAccuracy: 0.0,
13+
accuracy: 0.0,
14+
heading: 0.0,
15+
headingAccuracy: 0.0,
16+
speed: 0.0,
17+
speedAccuracy: 0.0,
18+
);
2119

2220
void main() {
2321
group('Geolocator', () {
@@ -78,21 +76,27 @@ void main() {
7876
});
7977

8078
test('getServiceStatusStream', () {
81-
when(GeolocatorPlatform.instance.getServiceStatusStream())
82-
.thenAnswer((_) => Stream.value(ServiceStatus.enabled));
79+
when(
80+
GeolocatorPlatform.instance.getServiceStatusStream(),
81+
).thenAnswer((_) => Stream.value(ServiceStatus.enabled));
8382

8483
final locationService = Geolocator.getServiceStatusStream();
8584

86-
expect(locationService,
87-
emitsInOrder([emits(ServiceStatus.enabled), emitsDone]));
85+
expect(
86+
locationService,
87+
emitsInOrder([emits(ServiceStatus.enabled), emitsDone]),
88+
);
8889
});
8990

9091
test('getPositionStream', () {
91-
when(GeolocatorPlatform.instance.getPositionStream(
92+
when(
93+
GeolocatorPlatform.instance.getPositionStream(
9294
locationSettings: const LocationSettings(
93-
accuracy: LocationAccuracy.best,
94-
timeLimit: null,
95-
))).thenAnswer((_) => Stream.value(mockPosition));
95+
accuracy: LocationAccuracy.best,
96+
timeLimit: null,
97+
),
98+
),
99+
).thenAnswer((_) => Stream.value(mockPosition));
96100

97101
final position = Geolocator.getPositionStream();
98102

@@ -125,8 +129,7 @@ class MockGeolocatorPlatform extends Mock
125129
with
126130
// ignore: prefer_mixin
127131
MockPlatformInterfaceMixin
128-
implements
129-
GeolocatorPlatform {
132+
implements GeolocatorPlatform {
130133
@override
131134
Future<LocationPermission> checkPermission() =>
132135
Future.value(LocationPermission.whileInUse);
@@ -139,42 +142,29 @@ class MockGeolocatorPlatform extends Mock
139142
Future<bool> isLocationServiceEnabled() => Future.value(true);
140143

141144
@override
142-
Future<Position> getLastKnownPosition({
143-
bool forceLocationManager = false,
144-
}) =>
145+
Future<Position> getLastKnownPosition({bool forceLocationManager = false}) =>
145146
Future.value(mockPosition);
146147

147148
@override
148-
Future<Position> getCurrentPosition({
149-
LocationSettings? locationSettings,
150-
}) =>
149+
Future<Position> getCurrentPosition({LocationSettings? locationSettings}) =>
151150
Future.value(mockPosition);
152151

153152
@override
154153
Stream<ServiceStatus> getServiceStatusStream() {
155154
return super.noSuchMethod(
156-
Invocation.method(
157-
#getServiceStatusStream,
158-
null,
159-
),
155+
Invocation.method(#getServiceStatusStream, null),
160156
returnValue: Stream.value(ServiceStatus.enabled),
161157
);
162158
}
163159

164160
@override
165-
Stream<Position> getPositionStream({
166-
LocationSettings? locationSettings,
167-
}) {
161+
Stream<Position> getPositionStream({LocationSettings? locationSettings}) {
168162
return super.noSuchMethod(
169-
Invocation.method(
170-
#getPositionStream,
171-
null,
172-
<Symbol, Object?>{
173-
#desiredAccuracy: locationSettings?.accuracy ?? LocationAccuracy.best,
174-
#distanceFilter: locationSettings?.distanceFilter ?? 0,
175-
#timeLimit: locationSettings?.timeLimit ?? 0,
176-
},
177-
),
163+
Invocation.method(#getPositionStream, null, <Symbol, Object?>{
164+
#desiredAccuracy: locationSettings?.accuracy ?? LocationAccuracy.best,
165+
#distanceFilter: locationSettings?.distanceFilter ?? 0,
166+
#timeLimit: locationSettings?.timeLimit ?? 0,
167+
}),
178168
returnValue: Stream.value(mockPosition),
179169
);
180170
}
@@ -189,8 +179,7 @@ class MockGeolocatorPlatform extends Mock
189179
@override
190180
Future<LocationAccuracyStatus> requestTemporaryFullAccuracy({
191181
required String purposeKey,
192-
}) =>
193-
Future.value(LocationAccuracyStatus.reduced);
182+
}) => Future.value(LocationAccuracyStatus.reduced);
194183

195184
@override
196185
Future<bool> openLocationSettings() => Future.value(true);
@@ -201,15 +190,13 @@ class MockGeolocatorPlatform extends Mock
201190
double startLongitude,
202191
double endLatitude,
203192
double endLongitude,
204-
) =>
205-
42;
193+
) => 42;
206194

207195
@override
208196
double bearingBetween(
209197
double startLatitude,
210198
double startLongitude,
211199
double endLatitude,
212200
double endLongitude,
213-
) =>
214-
42;
201+
) => 42;
215202
}

0 commit comments

Comments
 (0)