FLUTTER ECOSYSTEM

m-r-davari/dart_common_utilities

Dart 언어의 일반 유틸리티 패키지로 코드를 더 빠르고 간단하며 깔끔하게 만듭니다. Dart 기본 유형용으로 유용한 함수가 많이 포함되어 있습니다(모든 플러터 플랫폼 지원)

dart_common_utilities 프로젝트 이미지
Stars
41
Forks
1
최근 푸시(UTC)
2023. 12. 5.
프로젝트 상태
활성
MohammadReza Davari GitHub avatar
GITHUB User

MohammadReza Davari ↗

Senior Mobile App Developer 👨🏻‍💻, I use the 'Light' theme for my IDE 😄

언어Dart

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 4 개
  • flutter{"sdk":"flutter"}
  • intl^0.17.0
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^1.0.0

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

common_utilities

A Dart language Common Utility package, that makes your code faster,easier and cleaner. contains lots of useful functions for Dart primitive types (support all Flutter platforms)

Features

  • String : Over 30 useful String utility functions.

Todo (Next Versions)

  • Add Numbers (int, double, num, BigInt) utility functions.
  • Add Booleans (bool) utility functions.
  • Add Lists (List) utility functions.

Notes

version 0.1.1 Includes only String utils.

Usage

add this line to your pubspec.yaml :

    dependencies:
      common_utilities: ^0.1.1

or enter this to your command line:

    flutter pub add common_utilities

String Utils

Includes over 30 useful string functions such as :

  1. subStringBetween
  2. subStringsBetween
  3. subStringAfter
  4. subStringBefore
  5. insertAt
  6. removeAt
  7. insertAfter
  8. insertAfterEvery
  9. removeAfter
  10. removeBefore
  11. isNumericInt
  12. isNumericDouble
  13. isAlphabetic
  14. isUpperCase
  15. isAlphaNumeric
  16. isBlank
  17. isContainSpecialChar
  18. isValidCharacters
  19. convertEnglishNumberToPersian
  20. convertPersianNumberToEnglish
  21. convertToMoneyFormat
  22. countWords
  23. countLines
  24. reverse
  25. reverseWords
  26. removeBlankLines
  27. removeLinesThatContain
  28. isEmail
  29. convertToBase64
  30. convertBase64ToString
  31. convertToUTF8
  32. wrap
  33. isValidUrl

How To Use

Example for StringUtils :
import 'package:common_utilities/common_utilities.dart';

void main() {
  String yourStr = 'If you want something you have never had you must do something you have never done';

  String result = yourStr.stringUtils().subStringBetween('want', 'never');
  // print(result) =>  'something you have'

  List<String> result2 = yourStr.stringUtils().subStringsBetween('you', 'never');
  // print(result2) =>  ['something you have' , 'must do something you have']

  String result3 = yourStr.stringUtils().subStringAfter('something');
  // print(result3) =>  'you have never had you must do something you have never done'

  bool lastIndex = true; //This is optional & its false by default
  String result4 = yourStr.stringUtils().subStringAfter('something', lastIndex);
  // print(result4) =>  'you have never done'

  String str = CommonUtils.getRandomString(10);
  // print(str) =>  'btorklcvxw'

}

More Info

  • This package is equivalent of Common Utils library in Java, by this package there is no more need to write utils functions, just add it to your project and enjoy.
  • Feel free to make pull request to add your desire functions if its not included in the package functions list.