Skip to content

Commit

Permalink
Merge pull request #30 from natintosh/master
Browse files Browse the repository at this point in the history
#29: Fixed issue with - Unhandled Exception
  • Loading branch information
emostar committed Jun 14, 2021
2 parents 2dcce4e + 0721bd8 commit 1453b5e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

pubspec.lock

**/flutter_export_environment.sh

# Visual Studio Code related
.vscode/

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

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":"libphonenumber","path":"/Users/princesrivastava/Projects/Flutter/flutter-libphonenumber/","dependencies":[]}],"android":[{"name":"libphonenumber","path":"/Users/princesrivastava/Projects/Flutter/flutter-libphonenumber/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"libphonenumber","dependencies":[]}],"date_created":"2021-03-07 20:32:00.966457","version":"2.0.0"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"libphonenumber","path":"C:\\\\Users\\\\oguny\\\\AndroidStudioProjects\\\\Packages\\\\flutter-libphonenumber\\\\","dependencies":[]}],"android":[{"name":"libphonenumber","path":"C:\\\\Users\\\\oguny\\\\AndroidStudioProjects\\\\Packages\\\\flutter-libphonenumber\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"libphonenumber","dependencies":[]}],"date_created":"2021-03-25 23:32:04.485631","version":"2.0.2"}
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
28 changes: 15 additions & 13 deletions lib/libphonenumber.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ enum PhoneNumberType {
}

class PhoneNumberUtil {
static const MethodChannel _channel = const MethodChannel('codeheadlabs.com/libphonenumber');
static const MethodChannel _channel =
const MethodChannel('codeheadlabs.com/libphonenumber');

static Future<bool?> isValidPhoneNumber({
required String phoneNumber,
Expand Down Expand Up @@ -59,23 +60,24 @@ class PhoneNumberUtil {
}

static Future<String?> normalizePhoneNumber({
required String phoneNumber,
required String isoCode,
}) async {
return await _channel.invokeMethod('normalizePhoneNumber', {
'phone_number': phoneNumber,
'iso_code': isoCode,
});
}
required String phoneNumber,
required String isoCode,
}) async {
return await _channel.invokeMethod('normalizePhoneNumber', {
'phone_number': phoneNumber,
'iso_code': isoCode,
});
}

static Future<RegionInfo> getRegionInfo({
required String phoneNumber,
required String isoCode,
}) async {
Map<dynamic, dynamic> result = await (_channel.invokeMethod('getRegionInfo', {
Map<dynamic, dynamic> result =
await (_channel.invokeMethod('getRegionInfo', {
'phone_number': phoneNumber,
'iso_code': isoCode,
}) as FutureOr<Map<dynamic, dynamic>>);
}));

return RegionInfo(
regionPrefix: result['regionCode'],
Expand All @@ -95,9 +97,9 @@ class PhoneNumberUtil {
if (result == -1) {
return PhoneNumberType.unknown;
}
return PhoneNumberType.values[result!];
return PhoneNumberType.values[result!];
}

static Future<String?> formatAsYouType({
required String phoneNumber,
required String isoCode,
Expand Down

0 comments on commit 1453b5e

Please sign in to comment.