Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyryan committed Jul 6, 2021
1 parent 0bf61d3 commit 45fb850
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 32 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## [2.3.1]
Updated formatting
## [2.3.0]
Added a bitcoin wallet validator which supports regular BTC addresses as well as
SegWit (Bech32)
Expand Down
1 change: 0 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ class _MyHomePageState extends State<MyHomePage> {
label: 'Bitcoin Validator',
pageBuilder: () => BitcoinValidatorPage(),
),

],
),
),
Expand Down
7 changes: 4 additions & 3 deletions example/lib/pages/phone_format_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ class _PhoneFormatPageState extends State<PhoneFormatPage> {
onPressed: () {
if (_formKey.currentState!.validate()) {
_phoneController.text = formatAsPhoneNumber(
_phoneController.text,
allowEndlessPhone: false,
) ?? '';
_phoneController.text,
allowEndlessPhone: false,
) ??
'';
}
},
child: Row(
Expand Down
8 changes: 4 additions & 4 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.6.1"
base58check:
dependency: transitive
description:
Expand Down Expand Up @@ -96,7 +96,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.3.0"
version: "2.3.1"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -134,7 +134,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -169,7 +169,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.3.0"
typed_data:
dependency: transitive
description:
Expand Down
18 changes: 8 additions & 10 deletions lib/utils/bitcoin_validator/bitcoin_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ BitcoinWalletType getBitcoinWalletType(String? value) {
}

bool isBitcoinWalletValid(String? value) {
return getBitcoinWalletDetails(value).isValid;
return getBitcoinWalletDetails(value).isValid;
}

/// Detailed wallet check. The returned object contains all
/// the necessary info like address type, network, wallet type
/// and address. Before using the returned object, use isValid
/// Detailed wallet check. The returned object contains all
/// the necessary info like address type, network, wallet type
/// and address. Before using the returned object, use isValid
/// getter to check if the result is valid
BitcoinWalletDetails getBitcoinWalletDetails(String? value) {
if (value == null || value.length < 34) {
Expand Down Expand Up @@ -77,9 +77,7 @@ BitcoinWalletDetails _getSegWitDetails(
try {
Segwit decodedSegwit = segwit.decode(value);
programLength = decodedSegwit.program.length;
} catch (e) {

}
} catch (e) {}

BitcoinAddressType type = BitcoinAddressType.None;
switch (programLength) {
Expand All @@ -94,9 +92,9 @@ BitcoinWalletDetails _getSegWitDetails(
}
}

BitcoinAddressNetwork network = isSegwitTest
? BitcoinAddressNetwork.Testnet
: BitcoinAddressNetwork.Mainnet;
BitcoinAddressNetwork network = isSegwitTest
? BitcoinAddressNetwork.Testnet
: BitcoinAddressNetwork.Mainnet;

return BitcoinWalletDetails(
address: value,
Expand Down
11 changes: 5 additions & 6 deletions lib/utils/bitcoin_validator/bitcoin_wallet_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class BitcoinWalletDetails {
final BitcoinAddressNetwork addressNetwork;
final BitcoinWalletType walletType;

@override
@override
operator ==(covariant BitcoinWalletDetails other) {
return other.address == address &&
other.walletType == walletType &&
other.addressNetwork == addressNetwork &&
other.addressNetwork == addressNetwork;
return other.address == address &&
other.walletType == walletType &&
other.addressNetwork == addressNetwork &&
other.addressNetwork == addressNetwork;
}

@override
Expand Down Expand Up @@ -78,5 +78,4 @@ class BitcoinWalletDetails {
walletType: BitcoinWalletType.None,
);
}

}
2 changes: 1 addition & 1 deletion lib/utils/enum_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ T? enumFromString<T>(List<T> enumValues, String? value) {
return enumValues.singleWhereOrNull(
(enumItem) => enumToString(enumItem) == value,
);
}
}
6 changes: 3 additions & 3 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.6.1"
base58check:
dependency: "direct main"
description:
Expand Down Expand Up @@ -120,7 +120,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -155,7 +155,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.3.0"
typed_data:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_multi_formatter
description: A package of formatters for international phone numbers, credit / debit cards and a masked formatter
version: 2.3.0
version: 2.3.1
homepage: https://github.com/caseyryan/flutter_multi_formatter

environment:
Expand Down
6 changes: 3 additions & 3 deletions публикация
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flutter pub publish --dry-run проверка
flutter pub publish
fvm flutter pub publish --dry-run проверка
fvm flutter pub publish

flutter dartfmt . чтобы отформатировать всё файлы как надо
fvm flutter dartfmt . чтобы отформатировать всё файлы как надо

0 comments on commit 45fb850

Please sign in to comment.