Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(utils): implementation of number system #15

Merged
merged 4 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions lib/src/utils/number_system_utils.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:fa_dart_core/fa_dart_core.dart';

const decimalPlace = 2;
Khushboo1702 marked this conversation as resolved.
Show resolved Hide resolved

class NumberSystemUtils {
String parse(bool usesInternationalNumberSystem, num? val,
{int decimalPlaces = 0}) =>
usesInternationalNumberSystem
? _parseAsInternational(val ?? 0, decimalPlaces: decimalPlaces)
: _parseAsIndian(val ?? 0, decimalPlaces: decimalPlaces);

String _parseAsInternational(num val, {int decimalPlaces = 0}) {
return formatValue(
val.toDouble(),
locale: 'en_US',
decimalPlaces: decimalPlaces,
);
}

String _parseAsIndian(num val, {int decimalPlaces = 0}) {
return formatValue(
val.toDouble(),
locale: 'en_IN',
decimalPlaces: decimalPlaces,
);
}
}
34 changes: 17 additions & 17 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051
sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a
url: "https://pub.dev"
source: hosted
version: "64.0.0"
version: "61.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893"
sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562
url: "https://pub.dev"
source: hosted
version: "6.2.0"
version: "5.13.0"
ansicolor:
dependency: transitive
description:
Expand Down Expand Up @@ -102,10 +102,10 @@ packages:
dependency: transitive
description:
name: file
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
version: "6.1.4"
frontend_server_client:
dependency: transitive
description:
Expand Down Expand Up @@ -350,26 +350,26 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: "9b0dd8e36af4a5b1569029949d50a52cb2a2a2fdaa20cebb96e6603b9ae241f9"
sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46"
url: "https://pub.dev"
source: hosted
version: "1.24.6"
version: "1.24.3"
test_api:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "0.6.0"
test_core:
dependency: transitive
description:
name: test_core
sha256: "4bef837e56375537055fdbbbf6dd458b1859881f4c7e6da936158f77d61ab265"
sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e"
url: "https://pub.dev"
source: hosted
version: "0.5.6"
version: "0.5.3"
typed_data:
dependency: transitive
description:
Expand All @@ -390,10 +390,10 @@ packages:
dependency: transitive
description:
name: watcher
sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "1.0.2"
web_socket_channel:
dependency: transitive
description:
Expand All @@ -406,10 +406,10 @@ packages:
dependency: transitive
description:
name: webkit_inspection_protocol
sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572"
sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
version: "1.2.0"
yaml:
dependency: transitive
description:
Expand All @@ -419,4 +419,4 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.0.0 <4.0.0"
dart: ">=2.19.0 <3.0.0"
Loading