Flutter Dart Extension Methods

This repository contains a set of useful extension methods for common types in Flutter Dart. These extensions enhance the functionality of standard classes, providing convenient methods for everyday tasks.

Table of Contents

List Extensions

  • isNullOrEmpty: Checks if a list is null or empty.
  • isNotNullOrEmpty: Checks if a list is not nsull and not empty.
  • containsElement: Checks if the list contains a specific element.
  • firstOrDefault: Gets the first element in the list or a default value if the list is empty.
  • ... (and many more)

Map Extensions

  • containsKey: Checks if a key is present in the map.
  • containsValue: Checks if a value is present in the map.
  • keysList: Gets a list of keys in the map.
  • valuesList: Gets a list of values in the map.
  • ... (and many more)

String Extensions

  • isNullOrEmpty: Checks if a string is null or empty.
  • isNotNullOrEmpty: Checks if a string is not null and not empty.
  • isValidEmail: Checks if a string is a valid email address.
  • isValidUrl: Checks if a string is a valid URL.
  • ... (and many more)

DateTime Extensions

  • isToday: Checks if the date is today.
  • isYesterday: Checks if the date is yesterday.
  • isTomorrow: Checks if the date is tomorrow.
  • isThisWeek: Checks if the date is within the current week.
  • ... (and many more)

TextEditingController Extensions

  • clearText: Clears the text in the controller.
  • isNullOrEmpty: Checks if the text in the controller is null or empty.
  • isValidEmail: Checks if the text in the controller is a valid email address.
  • toCurrencyString: Converts the text in the controller to a currency format string.
  • ... (and many more)

Num Extensions

  • toHexString: Converts the number to a hexadecimal string.
  • isJson: Checks if the string is a valid JSON.
  • toCurrencyString: Converts the number to a currency format string.
  • ... (and many more)

Feel free to use these extensions in your Flutter Dart projects to simplify and enhance your code!

Contributions Welcome

Contributions are open! Feel free to contribute by adding more extensions, improving existing ones, fixing bugs, or suggesting new features. Let's build a comprehensive collection of Flutter Dart extensions together. Your help is highly appreciated!

Happy coding!

Libraries

extension_service