ns_utils 1.1.2 copy "ns_utils: ^1.1.2" to clipboard
ns_utils: ^1.1.2 copied to clipboard

ns_utils is a powerful Flutter utility library that simplifies and enhances your Flutter app development experience. It provides a collection of methods and extensions to streamline your code, making [...]

ns_utils - Flutter Utility Library #

Build Status License: MIT style: flutter_lints

Introduction #

ns_utils is a powerful Flutter utility library that simplifies and enhances your Flutter app development experience. It provides a collection of methods and extensions to streamline your code, making it more readable and efficient. Whether you need responsive design, date and time handling, map operations, string manipulation, or widget customization, ns_utils has got you covered.

Getting Started #

  1. Open your project's pubspec.yaml file.
  2. Add ns_utils as a dependency and replace [version] with the latest version:
dependencies:
  flutter:
    sdk: flutter
  ns_utils: ^[version]
  1. Run flutter pub get to fetch the package.

Import the Package #

import 'package:ns_utils/src.dart';

What's Inside #

ns_utils offers a wide range of features to simplify your Flutter development process:

CustomErrorWidget #

Demo

Learn more about it in the article Flutter -: KILL THE RED SCREEN OF DEATH.

Sizes #

Demo

Read about responsive app design in Flutter in Responsive App in Flutter.

BuildContext Extensions #

Simplify your code by using these extensions:

  • Replace lengthy Navigator.of(context).push(...) with context.push(...).
  • More intuitive methods like context.replace(...), context.makeFirst(...), and context.pop(...) are available.
  • Easily access device dimensions with context.mq.sizeX.width and context.mq.sizeX.height.
  • Simplify focus management with context.setFocus(focusNode: focusNode).

DateTime Extensions #

Enhance date and time handling with extensions like:

  • dayDifference: Get the difference in days between a date and the current date.
  • toServerFormat(): Get an ISO-8601 formatted date string.
  • isToday, isYesterday, isTomorrow: Check if a date is today, yesterday, or tomorrow.
  • tomorrow() and yesterday(): Get the next day or previous day.

Map Extensions #

Streamline operations on Map objects:

  • Use methods like getBool('key'), getInt('key'), getDouble('key'), getString('key'), getList('key'), and getMap('key') to retrieve values with optional default values.
  • Convert a Map to a JSON string using toJson().
  • Beautify Map output with toPretty().

List Extensions #

Manipulate lists easily with toJson(), which converts a list to a JSON string.

String Extensions #

Simplify string operations:

  • toMap(): Parse a JSON string into a Map.
  • toList(): Parse a JSON string into a List.
  • isEmptyOrNull: Check if a string is null or empty.
  • isNotBlank: Check if a string is not null, not empty, and not just whitespace.
  • toINT and toDOUBLE: Parse a string as an int or double.
  • asBool: Convert a string into a boolean.

double/int Extensions #

Enhance numeric operations with extensions like:

  • asBool: Convert an integer into a boolean.
  • Fractional operations: tenth, fourth, third, half, doubled, tripled.

Widget Extensions & Spacers #

Customize widgets with ease:

  • Add tooltips and gestures to widgets without complex nesting.
  • Utilize widgets like Container and SizedBox with simplified notation.
  • Expect even more widget enhancements in future updates.

Contributing #

You can contribute to ns_utils in various ways:

  • Propose new features or enhancements.
  • Report bugs.
  • Fix bugs.
  • Participate in discussions and help with decision-making.
  • Improve documentation.
  • Send pull requests with your contributions.

A big thank you to all our contributors!

19
likes
130
points
89
downloads

Publisher

verified publisherdart.nonstopio.com

Weekly Downloads

ns_utils is a powerful Flutter utility library that simplifies and enhances your Flutter app development experience. It provides a collection of methods and extensions to streamline your code, making it more readable and efficient. Whether you need responsive design, date and time handling, map operations, string manipulation, or widget customization, ns_utils has got you covered.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

after_layout, cached_network_image, device_info_plus, flutter, flutter_screenutil, flutter_spinkit, intl, objectid, package_info_plus, recase, shared_preferences, visibility_detector

More

Packages that depend on ns_utils