पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

GitHub रिपॉज़िटरीSky24n/sp_util

sp_util

Flutter shared_preferences प्लगइन उपकरण।

sp_util प्रोजेक्ट कवर
स्टार
35
फ़ोर्क
21
अंतिम पुश (UTC)
14 अप्रैल 2021
प्रोजेक्ट स्थिति
सक्रिय

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

sp_util

Pub      Pub

Flutter shared_preferences plugin util, support get default value, save object, object list. Use SharedPreferences easily.

Pub
dependencies:
  sp_util: ^2.0.3
APIs
getObj
getObjList
putObject
getObject
putObjectList
getObjectList
getString
putString
getBool
putBool
getInt
putInt
getDouble
putDouble
getStringList
putStringList
getDynamic
haveKey
getKeys
remove
clear
reload
isInitialized
Example
/// Example One.
/// await SpUtil initialization to complete before running the app.
/// sp init time release about 30ms,debug about 100ms.(Test on Android.)
void main() async {
  await SpUtil.getInstance();
  runApp(MyApp());
}

class MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
 
     /// examples
    SpUtil.putString("username", "sky24");
    String userName = SpUtil.getString("username", defValue: "");
    print("userName: " + userName);

    /// save object example.
    /// 存储实体对象示例。
    City city = City();
    city.name = "成都市";
    SpUtil.putObject("loc_city", city);

    City hisCity = SpUtil.getObj("loc_city", (v) => City.fromJson(v));
    print("City: " + (hisCity == null ? "null" : hisCity.toString()));

    /// save object list example.
    /// 存储实体对象list示例。
    List<City> list = List();
    list.add(City(name: "成都市"));
    list.add(City(name: "北京市"));
    SpUtil.putObjectList("loc_city_list", list);

    List<City> dataList = SpUtil.getObjList("loc_city_list", (v) => City.fromJson(v));
    print("CityList: " + (dataList == null ? "null" : dataList.toString()));
  }
  @override
  Widget build(BuildContext context) {
    return MaterialApp();
  }
}  


/// Example Two.
/// add SplashPage, complete sp initialization on the SplashPage. Then you can use it synchronously to the homepage。
...
...
More Util

common_utils Dart common utils.

  1. TimelineUtil : timeline util.
  2. TimerUtil : countdown,timer.
  3. MoneyUtil : fen to yuan, format output.
  4. LogUtil : simply encapsulate print logs.
  5. DateUtil : date conversion formatted output.
  6. RegexUtil : regular verification of mobile phone numbers, ID cards, mailboxes and so on.
  7. NumUtil : keep [x] decimal places, add subtract multiply divide without loosing precision.
  8. ObjectUtil : object is empty, two List is equal.
  9. EncryptUtil : xor, md5 ,Base64..
  10. TextUtil : hide phoneNo.
  11. JsonUtil : json to object.

flustars Flutter common utils.

  1. SpUtil : SharedPreferences Util.
  2. ScreenUtil : get screen width height density, appBarHeight, statusBarHeight, orientation.
  3. WidgetUtil : get Widget width height,coordinates.
  4. ImageUtil : get image size.
  5. DirectoryUtil : Directory Util.
dependencies:
  # https://github.com/Sky24n/common_utils
  common_utils: ^1.2.1
  # https://github.com/Sky24n/flustars
  flustars: ^0.3.3
  # https://github.com/Sky24n/sp_util
  sp_util: ^2.0.0

Changelog

Please see the Changelog page to know what's recently changed.

Sky24n GitHub avatar
भाषाएँDartRubySwiftJavaObjective-C

इस रिपॉज़िटरी के पैकेज

उपयोग की गई निर्भरताएँ

निर्भरता सूची 4 आइटम

अपने प्रोजेक्ट के लिए रिपॉज़िटरी कैसे चुनें?

उपयोग के अनुसार छाँटें, गतिविधि की तुलना करें और अपनाने से पहले मूल प्रोजेक्ट की आवश्यकताएँ जाँचें।

  1. नाम, लेखक या विवरण से खोजें और तकनीकी विषय से परिणाम सीमित करें।
  2. स्टार, फ़ोर्क और हाल के पुश की तुलना करें। स्टार रुचि दर्शाते हैं, गुणवत्ता की गारंटी नहीं।
  3. उपयोग से पहले GitHub पर README, लाइसेंस और Issues जाँचें।

स्रोत और रखरखाव

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗