Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Nipodemos
2020-09-13 01:38:34 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
50957f67c05f8b9e1ffc67a7edf018799a31f442
50957f67
1 parent
8151dfbd
last changes, all tests passed
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
126 deletions
lib/src/state_manager/rx/rx_core/rx_impl.dart
lib/src/utils/extensions/dynamic_extensions.dart
lib/src/utils/regex/get_utils_extensions.dart
test/get_state_test.dart
test/rx_event_test.dart
test/src/extensions/dynamic_extensions_test.dart
test/src/extensions/string_extensions_test.dart
lib/src/state_manager/rx/rx_core/rx_impl.dart
View file @
50957f6
...
...
@@ -32,8 +32,8 @@ class _RxImpl<T> implements RxInterface<T> {
///
/// // in your build(BuildContext) {
/// TextField(
// onChanged: myText,
// ),
/// onChanged: myText,
/// ),
///```
T
call
([
T
v
])
{
if
(
v
!=
null
)
{
...
...
lib/src/utils/extensions/dynamic_extensions.dart
View file @
50957f6
import
'../regex/get_utils.dart'
;
extension
GetDynamicUtils
on
dynamic
{
/// It's This is overloading the IDE's options. Only the most useful and
/// popular options will stay here.
bool
get
isNull
=>
GetUtils
.
isNull
(
this
);
bool
get
isNullOrBlank
=>
GetUtils
.
isNullOrBlank
(
this
);
...
...
lib/src/utils/regex/get_utils_extensions.dart
deleted
100644 → 0
View file @
8151dfb
import
'get_utils.dart'
;
extension
GetStringUtils
on
String
{
bool
get
isNum
=>
GetUtils
.
isNum
(
this
);
bool
get
isNumericOnly
=>
GetUtils
.
isNumericOnly
(
this
);
bool
get
isAlphabetOnly
=>
GetUtils
.
isAlphabetOnly
(
this
);
bool
get
isBool
=>
GetUtils
.
isBool
(
this
);
bool
get
isVectorFileName
=>
GetUtils
.
isVector
(
this
);
bool
get
isImageFileName
=>
GetUtils
.
isImage
(
this
);
bool
get
isAudioFileName
=>
GetUtils
.
isAudio
(
this
);
bool
get
isVideoFileName
=>
GetUtils
.
isVideo
(
this
);
bool
get
isTxtFileName
=>
GetUtils
.
isTxt
(
this
);
bool
get
isDocumentFileName
=>
GetUtils
.
isWord
(
this
);
bool
get
isExcelFileName
=>
GetUtils
.
isExcel
(
this
);
bool
get
isPPTFileName
=>
GetUtils
.
isPPT
(
this
);
bool
get
isAPKFileName
=>
GetUtils
.
isAPK
(
this
);
bool
get
isPDFFileName
=>
GetUtils
.
isPDF
(
this
);
bool
get
isHTMLFileName
=>
GetUtils
.
isHTML
(
this
);
bool
get
isURL
=>
GetUtils
.
isURL
(
this
);
bool
get
isEmail
=>
GetUtils
.
isEmail
(
this
);
bool
get
isPhoneNumber
=>
GetUtils
.
isPhoneNumber
(
this
);
bool
get
isDateTime
=>
GetUtils
.
isDateTime
(
this
);
bool
get
isMD5
=>
GetUtils
.
isMD5
(
this
);
bool
get
isSHA1
=>
GetUtils
.
isSHA1
(
this
);
bool
get
isSHA256
=>
GetUtils
.
isSHA256
(
this
);
bool
get
isBinary
=>
GetUtils
.
isBinary
(
this
);
bool
get
isIPv4
=>
GetUtils
.
isIPv4
(
this
);
bool
get
isIPv6
=>
GetUtils
.
isIPv6
(
this
);
bool
get
isHexadecimal
=>
GetUtils
.
isHexadecimal
(
this
);
bool
get
isPalindrom
=>
GetUtils
.
isPalindrom
(
this
);
bool
get
isPassport
=>
GetUtils
.
isPassport
(
this
);
bool
get
isCurrency
=>
GetUtils
.
isCurrency
(
this
);
bool
isCpf
(
String
s
)
=>
GetUtils
.
isCpf
(
this
);
bool
isCnpj
(
String
s
)
=>
GetUtils
.
isCnpj
(
this
);
bool
isCaseInsensitiveContains
(
String
b
)
=>
GetUtils
.
isCaseInsensitiveContains
(
this
,
b
);
bool
isCaseInsensitiveContainsAny
(
String
b
)
=>
GetUtils
.
isCaseInsensitiveContainsAny
(
this
,
b
);
String
capitalize
(
String
s
)
=>
GetUtils
.
capitalize
(
this
);
String
capitalizeFirst
(
String
s
)
=>
GetUtils
.
capitalizeFirst
(
this
);
String
removeAllWhitespace
(
String
s
)
=>
GetUtils
.
removeAllWhitespace
(
this
);
String
camelCase
(
String
s
)
=>
GetUtils
.
camelCase
(
this
);
String
numericOnly
(
String
s
,
{
bool
firstWordOnly
=
false
})
=>
GetUtils
.
numericOnly
(
this
,
firstWordOnly:
firstWordOnly
);
}
extension
GetNumUtils
on
num
{
bool
isLowerThan
(
num
b
)
=>
GetUtils
.
isLowerThan
(
this
,
b
);
bool
isGreaterThan
(
num
b
)
=>
GetUtils
.
isGreaterThan
(
this
,
b
);
bool
isEqual
(
num
b
)
=>
GetUtils
.
isEqual
(
this
,
b
);
}
extension
GetDynamicUtils
on
dynamic
{
bool
get
isNull
=>
GetUtils
.
isNull
(
this
);
bool
get
isNullOrBlank
=>
GetUtils
.
isNullOrBlank
(
this
);
}
test/get_state_test.dart
View file @
50957f6
...
...
@@ -25,7 +25,7 @@ void main() {
GetBuilder
<
Controller
>(
id:
'1'
,
didChangeDependencies:
(
_
)
{
print
(
"didChangeDependencies called"
);
//
print("didChangeDependencies called");
},
builder:
(
controller
)
{
return
Text
(
'id
${controller.counter}
'
);
...
...
test/rx_event_test.dart
View file @
50957f6
...
...
@@ -40,7 +40,7 @@ void main() {
final
count
=
0
.
obs
;
var
result
=
-
1
;
debounce
(
count
,
(
_
)
{
print
(
_
);
//
print(_);
result
=
_
as
int
;
},
time:
Duration
(
milliseconds:
100
));
...
...
@@ -58,7 +58,7 @@ void main() {
final
count
=
0
.
obs
;
var
result
=
-
1
;
interval
(
count
,
(
_
)
{
print
(
_
);
//
print(_);
result
=
_
as
int
;
},
time:
Duration
(
milliseconds:
100
));
...
...
test/src/extensions/dynamic_extensions_test.dart
View file @
50957f6
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
group
(
'Test group for extension: isNullOrBlank'
,
()
{
dynamic
testString
;
test
(
'String extension: isNullOrBlank'
,
()
{
expect
(
testString
.
isNullOrBlank
,
equals
(
true
));
});
test
(
'String extension: isNullOrBlank'
,
()
{
testString
=
'Not null anymore'
;
expect
(
testString
.
isNullOrBlank
,
equals
(
false
));
});
test
(
'String extension: isNullOrBlank'
,
()
{
testString
=
''
;
expect
(
testString
.
isNullOrBlank
,
equals
(
true
));
});
});
// group('dynamic extensions', () {
// var testString = '';
// test('var.isNullOrBlank returns true on a not initilized variable', () {
// expect(testString.isNullOrBlank, equals(true));
// });
// test('var.isNullOrBlank returns false on a initilized variable', () {
// testString = 'Not null anymore';
// expect(testString.isNullOrBlank, equals(false));
// });
// test('String extension: isNullOrBlank', () {
// testString = '';
// expect(testString.isNullOrBlank, equals(true));
// });
// });
}
...
...
test/src/extensions/string_extensions_test.dart
View file @
50957f6
...
...
@@ -257,7 +257,7 @@ void main() {
];
for
(
final
phone
in
phoneNumbers
)
{
print
(
'testing
$phone
'
);
//
print('testing $phone');
expect
(
phone
.
isPhoneNumber
,
true
);
}
...
...
@@ -571,7 +571,7 @@ void main() {
// 'omissíssimo',
];
for
(
final
palindrom
in
palindroms
)
{
print
(
"testing
$palindrom
"
);
//
print("testing $palindrom");
expect
(
palindrom
.
isPalindrom
,
true
);
}
expect
(
alphaNumeric
.
isPalindrom
,
false
);
...
...
@@ -620,7 +620,7 @@ void main() {
];
for
(
final
currency
in
currencies
)
{
print
(
'currency
$currency
'
);
//
print('currency $currency');
expect
(
currency
.
isCurrency
,
true
);
}
...
...
@@ -703,13 +703,13 @@ void main() {
expect
(
''
.
camelCase
,
null
);
});
test
(
'var.numericOnly'
,
()
{
expect
(
'foo bar'
.
numericOnly
,
'fooBar'
);
test
(
'var.numericOnly()'
,
()
{
expect
(
'date: 2020/09/13, time: 00:00'
.
numericOnly
(),
'202009130000'
);
expect
(
'the fox jumped in the water'
.
numericOnly
,
'theFoxJumpedInTheWater'
,
'and 1, and 2, and 1 2 3'
.
numericOnly
(),
'12123'
,
);
expect
(
''
.
numericOnly
,
null
);
expect
(
''
.
numericOnly
(),
''
);
});
});
}
...
...
Please
register
or
login
to post a comment