Skip to content

Commit

Permalink
Fixed issues with dart 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
aloisdeniel committed Aug 13, 2018
1 parent e3d417c commit f8e7bf1
Show file tree
Hide file tree
Showing 17 changed files with 11,909 additions and 39 deletions.
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Flutter",
"request": "launch",
"type": "dart"
}
]
}
1 change: 1 addition & 0 deletions example/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions example/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions example/ios/Flutter/flutter_assets/AssetManifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"]}
1 change: 1 addition & 0 deletions example/ios/Flutter/flutter_assets/FontManifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"fonts":[{"asset":"fonts/MaterialIcons-Regular.ttf"}],"family":"MaterialIcons"},{"family":"packages/cupertino_icons/CupertinoIcons","fonts":[{"asset":"packages/cupertino_icons/assets/CupertinoIcons.ttf"}]}]
11,869 changes: 11,869 additions & 0 deletions example/ios/Flutter/flutter_assets/LICENSE

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added example/ios/Flutter/flutter_assets/platform.dill
Binary file not shown.
Binary file not shown.
10 changes: 5 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ DEPENDENCIES:

EXTERNAL SOURCES:
Flutter:
:path: /Users/alois/flutter/bin/cache/artifacts/engine/ios
:path: "/Users/alois/flutter/bin/cache/artifacts/engine/ios"
geocoder:
:path: /Users/alois/flutter_geocoder/ios
:path: "/Users/alois/flutter_geocoder/ios"

SPEC CHECKSUMS:
Flutter: d674e78c937094a75ac71dd77e921e840bea3dbf
geocoder: 3cfab70531a0b367e917bafe82df4c30f6d4c45a
Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
geocoder: 333b5c474623c8223f367b6ac4846b5f9ea72e85

PODFILE CHECKSUM: 351e02e34b831289961ec3558a535cbd2c4965d2

COCOAPODS: 1.3.1
COCOAPODS: 1.5.2
24 changes: 4 additions & 20 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
9740EEBB1CF902C7004384FC /* app.flx in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB71CF902C7004384FC /* app.flx */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
Expand All @@ -42,14 +42,14 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
9740EEB71CF902C7004384FC /* app.flx */ = {isa = PBXFileReference; lastKnownFileType = file; name = app.flx; path = Flutter/app.flx; sourceTree = "<group>"; };
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -85,9 +85,9 @@
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
9740EEB71CF902C7004384FC /* app.flx */,
3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
Expand Down Expand Up @@ -161,7 +161,6 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
C3DD064462D8848B63F51267 /* [CP] Embed Pods Frameworks */,
1953A6C6D7DD1F53F17085CA /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -209,10 +208,10 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9740EEBB1CF902C7004384FC /* app.flx in Resources */,
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
Expand All @@ -222,21 +221,6 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
1953A6C6D7DD1F53F17085CA /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
4 changes: 2 additions & 2 deletions lib/geocoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import 'package:geocoder/services/local.dart';
export 'model.dart';

class Geocoder {
static final Geocoding local = new LocalGeocoding();
static Geocoding google(String apiKey) => new GoogleGeocoding(apiKey);
static final Geocoding local = LocalGeocoding();
static Geocoding google(String apiKey) => GoogleGeocoding(apiKey);
}
16 changes: 8 additions & 8 deletions lib/services/distant_google.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GoogleGeocoding implements Geocoding {
final HttpClient _httpClient;

GoogleGeocoding(this.apiKey) :
_httpClient = new HttpClient(),
_httpClient = HttpClient(),
assert(apiKey != null, "apiKey must not be null");

Future<List<Address>> findAddressesFromCoordinates(Coordinates coordinates) async {
Expand All @@ -37,19 +37,19 @@ class GoogleGeocoding implements Geocoding {
final response = await request.close();
final responseBody = await response.transform(utf8.decoder).join();
print("Received $responseBody...");
Map data = jsonDecode(responseBody);
var data = jsonDecode(responseBody);

List<Map> results = data["results"];
var results = data["results"];

if(results == null)
return null;

return results.map(_convertAddress)
.map((map) => new Address.fromMap(map))
.map<Address>((map) => Address.fromMap(map))
.toList();
}

Map _convertCoordinates(Map geometry) {
Map _convertCoordinates(dynamic geometry) {
if(geometry == null)
return null;

Expand All @@ -63,14 +63,14 @@ class GoogleGeocoding implements Geocoding {
};
}

Map _convertAddress(Map data) {
Map _convertAddress(dynamic data) {

Map result = new Map();
Map result = Map();

result["coordinates"] = _convertCoordinates(data["geometry"]);
result["addressLine"] = data["formatted_address"];

List<Map> addressComponents = data["address_components"];
var addressComponents = data["address_components"];

addressComponents.forEach((item) {

Expand Down
6 changes: 3 additions & 3 deletions lib/services/local.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import 'package:geocoder/services/base.dart';

/// Geocoding and reverse geocoding through built-lin local platform services.
class LocalGeocoding implements Geocoding {
static const MethodChannel _channel = const MethodChannel('github.com/aloisdeniel/geocoder');
static const MethodChannel _channel = MethodChannel('github.com/aloisdeniel/geocoder');

Future<List<Address>> findAddressesFromCoordinates(Coordinates coordinates) async {
Iterable addresses = await _channel.invokeMethod('findAddressesFromCoordinates', coordinates.toMap());
return addresses.map((x) => new Address.fromMap(x)).toList();
return addresses.map((x) => Address.fromMap(x)).toList();
}

Future<List<Address>> findAddressesFromQuery(String address) async {
Iterable coordinates = await _channel.invokeMethod('findAddressesFromQuery', { "address" : address });
return coordinates.map((x) => new Address.fromMap(x)).toList();
return coordinates.map((x) => Address.fromMap(x)).toList();
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: geocoder
description: Forward and reverse geocoding.
version: 0.1.0
version: 0.1.1
author: Aloïs Deniel<[email protected]>
homepage: https://github.com/aloisdeniel/flutter_geocoder

Expand Down

0 comments on commit f8e7bf1

Please sign in to comment.