Skip to content

Commit 3d69b74

Browse files
authored
Updated coded example to reflect current code style conventions (#1018)
1 parent 0c2dc2d commit 3d69b74

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

packages/location/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,29 +98,29 @@ import 'package:location/location.dart';
9898
In order to request location, you should always check Location Service status and Permission status manually
9999

100100
```dart
101-
Location location = new Location();
101+
Location location = Location();
102102
103-
bool _serviceEnabled;
104-
PermissionStatus _permissionGranted;
105-
LocationData _locationData;
103+
bool serviceEnabled;
104+
PermissionStatus permissionGranted;
105+
LocationData locationData;
106106
107-
_serviceEnabled = await location.serviceEnabled();
108-
if (!_serviceEnabled) {
109-
_serviceEnabled = await location.requestService();
110-
if (!_serviceEnabled) {
107+
serviceEnabled = await location.serviceEnabled();
108+
if (!serviceEnabled) {
109+
serviceEnabled = await location.requestService();
110+
if (!serviceEnabled) {
111111
return;
112112
}
113113
}
114114
115-
_permissionGranted = await location.hasPermission();
116-
if (_permissionGranted == PermissionStatus.denied) {
117-
_permissionGranted = await location.requestPermission();
118-
if (_permissionGranted != PermissionStatus.granted) {
115+
permissionGranted = await location.hasPermission();
116+
if (permissionGranted == PermissionStatus.denied) {
117+
permissionGranted = await location.requestPermission();
118+
if (permissionGranted != PermissionStatus.granted) {
119119
return;
120120
}
121121
}
122122
123-
_locationData = await location.getLocation();
123+
locationData = await location.getLocation();
124124
```
125125

126126
You can also get continuous callbacks when your position is changing:

0 commit comments

Comments
 (0)