Nipodemos

last changes, all tests passed

... ... @@ -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) {
... ...
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);
... ...
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);
}
... ... @@ -25,7 +25,7 @@ void main() {
GetBuilder<Controller>(
id: '1',
didChangeDependencies: (_) {
print("didChangeDependencies called");
// print("didChangeDependencies called");
},
builder: (controller) {
return Text('id ${controller.counter}');
... ...
... ... @@ -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));
... ...
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));
// });
// });
}
... ...
... ... @@ -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(), '');
});
});
}
... ...