Git Product home page Git Product logo

flutter_commons_lang's Introduction

flutter_commons_lang

commons_lang for flutter, provide DateUtils, StringUtils and so on...

Usage

NumberUtils

provider add/subtract/multiple/divide to safe calculate with scale,keep param's runtimeType or custom to returnType.

NumberUtils.getScale(1.12346);
NumberUtils.setScale(1.1246, scale: 2, roundingMode: ROUND_UP);

int a = NumberUtils.add(1, 2);
double b = NumberUtils.add(1, 2, returnType: double);

NumberUtils.add(0.3, 0.6);
NumberUtils.subtract(0.3, 0.2);
NumberUtils.multiply(0.3, 1.5);
NumberUtils.divide(0.3, 0.1);

NumberUtils.multiply(1.2354, 2.365, scale: 2);
NumberUtils.divide(12354, 7, scale: 5, roundingMode: ROUND_HALF_UP);

StringUtils

provider some easy op.

print(StringUtils.isBlank(null));
print(StringUtils.isBlank(""));
print(StringUtils.isBlank("   "));
print(StringUtils.isBlank(" b "));

ListUtils

provider the convert of list to string and string to list.

  List list = [1, 2, 3, 4, 5];
  String text = ListUtils.listToString(list);
  list = ListUtils.stringToList(text);
  text = ListUtils.listToString(list, ",");
  list = ListUtils.stringToList(text, ",");

DateUtils

easy to op datetime. as today, yesterday as set hour,set day as truncate as daysOfTheMonth

DateTime time = DateUtils.parse("2018-12-11");
DateUtils.format(time);
DateUtils.format(time, "yyyy.MM.dd");

DateTime time1 = DateUtils.today();
DateTime time2 = DateUtils.today(hour:9);
DateTime time3 = DateUtils.yesterday();
DateTime time4 = DateUtils.set(DateTime.now(), year:2017);
DateTime time5 = DateUtils.truncate(DateTime.now(), hour:9, minute:30);
DateUtils.truncatedEquals(time1,time2,DateUtils.MONTH);
DateUtils.truncatedEquals(time1,time5,DateUtils.DAY);
DateUtils.daysOfTheMonth(time1);

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

flutter_commons_lang's People

Watchers

James Cloos 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.