dartkt 1.0.2 copy "dartkt: ^1.0.2" to clipboard
dartkt: ^1.0.2 copied to clipboard

outdated

A dart library for lazier programmers. Functions are ported from kotlin.

DartKT #

A dart library for lazier programmers.

Getting Started #

Add dependence of dartkt to your project. The last version is 1.0.2 .

dependencies:
    ... ...
    dartkt: ^1.0.2

Functions #

Functions in the library are ported from kotlin, also included some useful utils like http.

Here is a list for cognition:

Class Method Definition Note
KTObjectExtension also T also(void Function(T) block)
let R let<R>(R Function(T) block)
takeIf T takeIf(bool Function(T) block)
takeUnless T takeUnless(bool Function(T) block)
HttpMethod GET, HEAD, POST, PUT, DELETE
HttpResponse
HttpError
http http Future<HttpResponse> http(String url, HttpMethod method, {Map<String, String> param,String mimeType='application/json', String body, Map<String, String> postParam, Map<String, String> fileParam, Map<String, String> headers, int timeout=15})
httpGet Future<HttpResponse> httpGet(String url, {Map<String, String> param, Map<String, String> headers})
httpPost Future<HttpResponse> httpPost(String url, {Map<String, String> param, String body, Map<String, String> headers})
DownloadState Start, Progress, Complete, Error
DownloadCallback void Function(DownloadState state, int position, int filesize, String error)
download download Future<bool> download(String url, String localFile, DownloadCallback callback)
KTPair toList List<T> toList()
KTTriple toList List<A> toList()
KTStringExtension substringBefore String substringBefore(Pattern pattern)
substringAfter String substringAfter(Pattern pattern)
substringBeforeLast String substringBeforeLast(Pattern pattern)
substringAfterLast String substringAfterLast(Pattern pattern)
removeRange String removeRange(int startIdx, int endIdx)
removePrefix String removePrefix(Pattern pattern)
removeSuffix String removeSuffix(Pattern pattern)
removeSurrounding String removeSurrounding(Pattern pattern)
replaceBefore String replaceBefore(Pattern pattern, String replacement)
replaceAfter String replaceAfter(Pattern pattern, String replacement)
replaceAfterLast String replaceAfterLast(Pattern pattern, String replacement)
replaceBeforeLast String replaceBeforeLast(Pattern pattern, String replacement)
lines List<String> lines()
drop String drop(int n)
dropLast String dropLast(int n)
filter String filter(bool Function(String) block)
filterIndexed String filterIndexed(bool Function(int, String) block)
filterNot String filterNot(bool Function(String) block)
reversed String reversed()
toList List<String> toList()
map List<T> map<T>(T Function(String) block)
mapIndexed List<T> mapIndexed<T>(T Function(int, String) block)
forEach forEach(void Function(String) action)
forEachIndexed forEachIndexed(void Function(int, String) action)
reduce String reduce(String Function(String, String) block)
reduceIndexed String reduceIndexed(String Function(int, String, String) block)
toInt int toInt()
toDouble double toDouble()
toBool bool toBool()
base64encode String base64encode()
base64decode String base64decode()
toIntList List<int> toIntList()
lastPathPart String lastPathPart()
getPathDirectory String getPathDirectory()
toJsonEncoded String toJsonEncoded()
toTitleUpperCase String toTitleUpperCase()
appendPathPart String appendPathPart(String part)
extension String extension()
replaceTag String replaceTag(String tag, String Function() block)
skipEmptyLine String skipEmptyLine()
toPair KTPair<String, String> toPair()
save save(File f)
asFileWriteText File asFileWriteText(String s)
asFileReadText String asFileReadText()
asFileMkdirs asFileMkdirs()
asFile File asFile()
hash String hash([String alg])
md5sha1 String get md5sha1
KTListExtension<T> find T find(bool Function(T) block)
findLast T findLast(bool Function(T) block)
indexOfFirst int indexOfFirst(bool Function(T) block)
indexOfLast int indexOfLast(bool Function(T) block)
drop List<T> drop(int n)
dropLast List<T> dropLast(int n)
filter List<T> filter(bool Function(T) block)
filterIndexed List<T> filterIndexed(bool Function(int, T) block)
filterNot List<T> filterNot(bool Function(T) block)
slice List<T> slice(int startIdx, int endIdx)
sortBy List<T> sortBy(int Function(T, T) block)
sortByDescending List<T> sortByDescending(int Function(T, T) block)
map2 List<R> map2<R>(R Function(T) block) overrided
map2Indexed List<R> map2Indexed<R>(R Function(int, T) block)
distinct List<T> distinct()
distinctBy List<T> distinctBy<R>(R Function(T) block)
all bool all(bool Function(T) block)
any bool any(bool Function(T) block)
count int count(bool Function(T) block)
forEachIndexed forEachIndexed(void Function(int, T) block)
none bool none(bool Function(T) block)
reduceIndexed T reduceIndexed(T Function(int, T, T) block)
minus minus(List<T> list)
joinToString String joinToString([String sep = ',', String Function(T) block])
toStringList List<String> toStringList()
toMap Map<K, V> toMap<K, V>()
mapTo C mapTo<R, C extends List<R>>(C dest, R Function(T))
mapIndexedTo C mapIndexedTo<R, C extends List<R>>(C dest, R Function(int, T) block)
filterTo C filterTo<C extends List<T>>(C dest, bool Function(T) block)
filterIndexedTo C filterIndexedTo<C extends List<T>>(C dest, bool Function(int, T) block)
filterNotTo C filterNotTo<C extends List<T>>(C dest, bool Function(T) block)
toGridData List<List<T>> toGridData([int column = 1])
KTListListExtension<T> toListData List<T> toListData()
KTSetExtension<T> find T find(bool Function(T) block)
findLast T findLast(bool Function(T) block)
indexOfFirst int indexOfFirst(bool Function(T) block)
indexOfLast int indexOfLast(bool Function(T) block)
drop Set<T> drop(int n)
dropLast Set<T> dropLast(int n)
filter Set<T> filter(bool Function(T) block)
filterIndexed Set<T> filterIndexed(bool Function(int, T) block)
filterNot Set<T> filterNot(bool Function(T) block)
slice Set<T> slice(int startIdx, int endIdx)
sortBy Set<T> sortBy(int Function(T, T) block)
sortByDescending Set<T> sortByDescending(int Function(T, T) block)
map2 Set<R> map2<R>(R Function(T) block) overrided
map2Indexed Set<R> map2Indexed<R>(R Function(int, T) block)
distinct Set<T> distinct()
distinctBy Set<T> distinctBy<R>(R Function(T) block)
all bool all(bool Function(T) block)
any bool any(bool Function(T) block)
count int count(bool Function(T) block)
forEachIndexed forEachIndexed(void Function(int, T) block)
none bool none(bool Function(T) block)
reduceIndexed T reduceIndexed(T Function(int, T, T) block)
minus minus(Set<T> s)
joinToString String joinToString([String sep = ',', String Function(T) block])
toStringList Set<String> toStringList()
toMap Map<K, V> toMap<K, V>()
mapTo C mapTo<R, C extends Set<R>>(C dest, R Function(T) block)
mapIndexedTo C mapIndexedTo<R, C extends Set<R>>(C dest, R Function(int, T) block)
filterTo C filterTo<C extends Set<T>>(C dest, bool Function(T) block)
filterIndexedTo C filterIndexedTo<C extends Set<T>>(C dest, bool Function(int, T) block)
filterNotTo C filterNotTo<C extends Set<T>>(C dest, bool Function(T) block)
KTMapExtension<K, V> toList List<KTPair<K, V>> toList()
mapToList List<R> mapToList<R>(R Function(MapEntry<K, V>) block)
forEachEntry forEachEntry(void Function(MapEntry<K, V>) block)
all bool all(bool Function(MapEntry<K, V>) block)
any bool any(bool Function(MapEntry<K, V>) block)
count int count(bool Function(MapEntry<K, V>) block)
none bool none(bool Function(MapEntry<K, V>) block)
filterKeys Map<K, V> filterKeys(bool Function(K) block)
filterValues Map<K, V> filterValues(bool Function(V) block)
filter Map<K, V> filter(bool Function(MapEntry<K, V>) block)
filterNot Map<K, V> filterNot(bool Function(MapEntry<K, V>) block)
add add(Map<K, V> m)
minus minus(Map<K, V> m)
filterTo Map<K, V> filterTo<M extends Map<K, V>>(M dest, bool Function(MapEntry<K, V>) block)
filterNotTo Map<K, V> filterNotTo<M extends Map<K, V>>(M dest, bool Function(MapEntry<K, V>) block)
filterKeysTo Map<K, V> filterKeysTo<M extends Map<K, V>>(M dest, bool Function(K) block)
filterValuesTo Map<K, V> filterValuesTo<M extends Map<K, V>>(M dest, bool Function(V) Block)
mapTo Map<K2, V2> mapTo<K2, V2, C extends Map<K2, V2>>(C dest, MapEntry<K2, V2> Function(MapEntry<K, V>) block)
mapToListTo List<R> mapToListTo<R, C extends List<R>>(C dest, R Function(MapEntry<K, V>) block)
mapKeysTo Map<K2, V2> mapKeysTo<K2, V2, C extends Map<K2, V2>>(C dest, MapEntry<K2, V2> Function(K) block)
mapKeysToListTo List<R> mapKeysToListTo<R, C extends List<R>>(C dest, R Function(K) block)
mapValuesTo Map<K2, V2> mapValuesTo<K2, V2, C extends Map<K2, V2>>(C dest, MapEntry<K2, V2> Function(V) block)
mapValuesToListTo List<R> mapValuesToListTo<R, C extends List<R>>(C dest, R Function(V) block)
RegexUtil isStringReg bool isStringReg(String str, int type)
isNumberReg bool isNumberReg(String str, int type)
isEmail bool isEmail(String str)
isPhoneNumber bool isPhoneNumber(String str)
isCellPhoneNumber bool isCellPhoneNumber(String str)
isChinesePhoneNumber bool isChinesePhoneNumber(String str)
isIdCardNumber bool isIdCardNumber(String str)
isShortIdCardNumber bool isShortIdCardNumber(String str)
isUrl bool isUrl(String str)
isDomain bool isDomain(String str)
isValidAccount bool isValidAccount(String str)
isValidPassword bool isValidPassword(String str)
isStrongPassword bool isStrongPassword(String str)
isDate bool isDate(String str)
isValidXml bool isValidXml(String str)
isBlankLine bool isBlankLine(String str)
isValidHtml bool isValidHtml(String str)
isValidQQNumber bool isValidQQNumber(String str)
isValidPostCode bool isValidPostCode(String str)
isValidIPAddress bool isValidIPAddress(String str)
3
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A dart library for lazier programmers. Functions are ported from kotlin.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

convert, crypto

More

Packages that depend on dartkt