Giter Club home page Giter Club logo

ns_utils's Introduction

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!

ns_utils's People

Contributors

projectaj14 avatar rajan-nonstopio avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.