Skip to content

Commit

Permalink
migrated to flutter v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dammyololade committed Apr 16, 2021
1 parent c0a69d5 commit 14df142
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 40 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ pubspec.lock
lib/src/Constants.dart
lib/src/constants.dart
example/lib/Constants.dart
.fvm
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## [1.0.0] - 16-04-2021
Released a null safety version
## [0.2.6] - 07-03-2021
updated http package
## [0.2.5] - 07-03-2021
Expand Down
2 changes: 1 addition & 1 deletion example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_maps_flutter","path":"/Users/dammyololade/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-1.2.0/","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/dammyololade/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.11/","dependencies":[]},{"name":"google_maps_flutter","path":"/Users/dammyololade/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-1.2.0/","dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]}],"date_created":"2021-03-15 09:10:44.434586","version":"1.25.0-8.1.pre"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_maps_flutter","path":"/Users/dammyololade/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-1.2.0/","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/dammyololade/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.11/","dependencies":[]},{"name":"google_maps_flutter","path":"/Users/dammyololade/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-1.2.0/","dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]}],"date_created":"2021-04-16 23:27:17.648271","version":"2.0.1"}
2 changes: 1 addition & 1 deletion example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/dammyololade/Development/flutter"
export "FLUTTER_ROOT=/Users/dammyololade/fvm/versions/2.0.1"
export "FLUTTER_APPLICATION_PATH=/Users/dammyololade/StudioProjects/novu/flutter_polyline_points/example"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
Expand Down
6 changes: 2 additions & 4 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import 'package:google_maps_flutter/google_maps_flutter.dart';

import 'package:flutter_polyline_points/flutter_polyline_points.dart';

import 'Constants.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
Expand Down Expand Up @@ -45,7 +43,7 @@ class _MapScreenState extends State<MapScreen> {
Map<PolylineId, Polyline> polylines = {};
List<LatLng> polylineCoordinates = [];
PolylinePoints polylinePoints = PolylinePoints();
String googleAPiKey = Constants.MAP_API_KEY;
String googleAPiKey = "Please provide your api key";

@override
void initState() {
Expand Down Expand Up @@ -101,7 +99,7 @@ class _MapScreenState extends State<MapScreen> {

_getPolyline() async {
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
Constants.API_KEY,
googleAPiKey,
PointLatLng(_originLatitude, _originLongitude),
PointLatLng(_destLatitude, _destLongitude),
travelMode: TravelMode.driving,
Expand Down
44 changes: 22 additions & 22 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0-nullsafety.3"
version: "2.5.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.5"
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.3"
version: "1.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.5"
version: "1.15.0"
cupertino_icons:
dependency: "direct main"
description:
Expand All @@ -56,7 +56,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.3"
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -101,35 +101,35 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.0-nullsafety.0"
version: "0.13.1"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0-nullsafety"
version: "4.0.0"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10-nullsafety.3"
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.6"
version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.3"
version: "1.8.0"
pedantic:
dependency: transitive
description:
Expand All @@ -155,21 +155,21 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.4"
version: "1.8.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0-nullsafety.6"
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
stream_transform:
dependency: transitive
description:
Expand All @@ -183,35 +183,35 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.3"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19-nullsafety.6"
version: "0.2.19"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.5"
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.5"
version: "2.1.0"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
flutter: ">=1.22.0 <2.0.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.22.0"
4 changes: 1 addition & 3 deletions lib/src/PointLatLng.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ class PointLatLng {
/// [longitude].
///
const PointLatLng(double latitude, double longitude)
: assert(latitude != null),
assert(longitude != null),
this.latitude = latitude,
: this.latitude = latitude,
this.longitude = longitude;

/// The latitude in degrees.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/network_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class NetworkUtil {
//String url = uri.toString();
// print('GOOGLE MAPS URL: ' + url);
var response = await http.get(uri);
if (response?.statusCode == 200) {
if (response.statusCode == 200) {
var parsedJson = json.decode(response.body);
result.status = parsedJson["status"];
if (parsedJson["status"]?.toLowerCase() == STATUS_OK &&
Expand Down
4 changes: 2 additions & 2 deletions lib/src/utils/polyline_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class PolylineResult {
/// the api status retuned from google api
///
/// returns OK if the api call is successful
String status;
String? status;

/// list of decoded points
List<PointLatLng> points;

/// the error message returned from google, if none, the result will be empty
String errorMessage;
String? errorMessage;

PolylineResult({this.status, this.points = const [], this.errorMessage = ""});

Expand Down
3 changes: 1 addition & 2 deletions lib/src/utils/polyline_waypoint.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/material.dart';

/// description:
/// project: flutter_polyline_points
Expand All @@ -19,7 +18,7 @@ class PolylineWayPoint {
/// which has the effect of splitting the route into two routes
bool stopOver;

PolylineWayPoint({@required this.location, this.stopOver = true});
PolylineWayPoint({required this.location, this.stopOver = true});

@override
String toString() {
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: flutter_polyline_points
description: A flutter package to get polyline points by either passing the coordinates or google encoded polyline string
version: 0.2.6
version: 1.0.0
homepage: https://github.com/Dammyololade/flutter_polyline_points

environment:
sdk: ">=2.1.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
sdk: flutter
http: ^0.13.0-nullsafety.0
http: ^0.13.1

dev_dependencies:
flutter_test:
Expand Down
1 change: 0 additions & 1 deletion test/flutter_polyline_points_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ void main() {
polylinePoints.decodePolyline("_p~iF~ps|U_ulLnnqC_mqNvxq`@");
print("Answer ---- ");
print(points);
assert(points != null);
assert(points.length > 0);
});
}

0 comments on commit 14df142

Please sign in to comment.