extensions_lover 1.2.0 copy "extensions_lover: ^1.2.0" to clipboard
extensions_lover: ^1.2.0 copied to clipboard

Contains some of the methods and getters in extensions that mostly used by Flutter Developer

pub package Star on Github style: very good analysis License: MIT

  • Helps to not write so much words (context.width instead of MediaQuery.of(context).size.width)
  • have helper methods for some of data types (list.isNullOrEmpty instead of list == null || list!.isEmpty) This Package contains extensions for Strings, List, Media Query, and more.

Features #

In this package:

  • For Lists
    • Check if the list is Null Or Empty
    • Check if the list is Not Null Not Empty
  • For Strings
    • concatenate Asterisk
    • concatenate Colon
    • concatenate Exclamation
    • concatenate Comma
    • concatenate Dash
    • concatenate Hash
    • concatenate Space
    • concatenate Newline
    • concatenate Brackets
    • concatenate Question Mark English
    • concatenate Dollar Sign
    • concatenate Question Mark Arabic
    • Take first N characters from a string
    • Take first N words from a string
  • For DateTime
    • Check if date is today
    • Check if date is yesterday
    • Check if date is tomorrow
  • For Media Query
    • context.height
    • context.width
    • context.toPadding
    • context.bottom

Getting started #

  1. Add extensions_lover: ^latest_version on dependencies.

  2. Add an import for package:extensions_lover/extensions_lover.dart.

  3. Use extensions_lover in your code:

import 'package:extensions_lover/extensions_lover.dart';

void main() {
  /// concatenate Exclamation
  print('Hello Extensions Lover'.concatenateExclamation);
  //will print: Hello Extensions Lover!
}

Usage #

With Strings #

 const helloFlutter = 'Hello Flutter';

  /// concatenate Asterisk
  print(helloFlutter.concatenateAsterisk);

  /// concatenate Asterisk
  print(helloFlutter.concatenateAsterisk);

  /// concatenate Colon
  print(helloFlutter.concatenateColon);

  /// concatenate Exclamation
  print(helloFlutter.concatenateExclamation);

  /// concatenate Comma
  print(helloFlutter.concatenateComma);

  /// concatenate Dash
  print(helloFlutter.concatenateDash);

  /// concatenate Hash
  print(helloFlutter.concatenateHash);

  /// concatenate Space
  print(helloFlutter.concatenateSpace);

  /// concatenate Newline
  print(helloFlutter.concatenateNewline);

  /// concatenate Brackets
  print(helloFlutter.concatenateBrackets);

  /// concatenate Question Mark English
  print(helloFlutter.concatenateQuestionMarkEnglish);

  /// concatenate Dollar Sign
  print(helloFlutter.concatenateDollarSign);

  /// concatenate Question Mark Arabic
  print(helloFlutter.concatenateQuestionMarkArabic);

  /// Take first N characters
  print('Hello World'.takeChars(5)); // Output: Hello

  /// Take first N words
  print('Hello World from Dart'.takeWords(2)); // Output: Hello World

With Lists #


List<dynamic>? list;
  print(list.isNullOrEmpty); // true
  list = [];
  print(list.isNullOrEmpty); // true
  list = ['Flutter'];
  print(list.isNullOrEmpty); // false
  print(list.isNotNullNotEmpty); // true

With DateTime #

final today = DateTime.now();
final yesterday = today.subtract(const Duration(days: 1));
final tomorrow = today.add(const Duration(days: 1));

print(today.isToday);       // true
print(yesterday.isYesterday); // true
print(tomorrow.isTomorrow);   // true

Additional information #

  • The package is in the initial phase.
  • Fell free to add issues or create pull requests as you want
2
likes
150
points
32
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Contains some of the methods and getters in extensions that mostly used by Flutter Developer

Repository (GitHub)
View/report issues

Topics

#extensions

License

MIT (license)

Dependencies

flutter, intl

More

Packages that depend on extensions_lover