Skip to content

Commit

Permalink
Merge branch 'develop' into fix/620348-ticket-card-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Rossi committed Apr 4, 2024
2 parents 90ae88e + 4aaa051 commit a99666e
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 105 deletions.
1 change: 1 addition & 0 deletions lib/blip_ds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export 'src/extensions/ds_border_radius.extension.dart'
show DSBorderRadiusExtension, DSBorderRadiusListExtension;
export 'src/extensions/ds_delivery_report_status.extension.dart'
show DSDeliveryReportStatusExtension;
export 'src/extensions/ds_string.extension.dart' show DSStringExtension;
export 'src/models/ds_message_bubble_avatar_config.model.dart'
show DSMessageBubbleAvatarConfig;
export 'src/models/ds_message_bubble_style.model.dart'
Expand Down
21 changes: 21 additions & 0 deletions lib/src/extensions/ds_string.extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'dart:core';

import 'package:phone_number/phone_number.dart';

extension DSStringExtension on String {
Future<String> asPhoneNumber() async {
try {
final plugin = PhoneNumberUtil();

final phone = startsWith('+') ? this : '+$this';
final regionCode = (await plugin.parse(phone)).regionCode;

return plugin.format(
phone,
regionCode,
);
} catch (_) {
return this;
}
}
}
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dependencies:
crypto: ^3.0.3
video_compress: ^3.1.2
flutter_image_compress: ^2.1.0
phone_number: ^2.0.1

dev_dependencies:
flutter_test:
Expand Down
Loading

0 comments on commit a99666e

Please sign in to comment.