flutter_kv 0.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 61

flutter_kv #

A Flutter plugin to use MMKV which is an efficient, small mobile key-value storage framework developed by WeChat.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

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

0.0.1 #

  • TODO: Describe initial release.


import 'package:flutter/material.dart';
import 'package:flutter_kv/flutter_kv.dart';
void main(){
  return runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      home: new MyHomePage(title: 'Flutter Demo Home Page'),

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  _MyHomePageState createState() => new _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() async{
    setState(() {
    print("count: $_counter");
    print("存一个布尔类型的true: ${await FlutterKV.encodeBool("bool", true)}");
    print("取出刚才存的布尔值: ${await FlutterKV.decodeBool("bool", false)}");

    print("存一个int类型的92: ${await FlutterKV.encodeInt("int", 92)}");
    print("取出刚才存的int类型值: ${await FlutterKV.decodeInt("int", 0)}");

    print("存一个long int类型的9223372036854775806: ${await FlutterKV.encodeLong("long", 9223372036854775806)}");
    print("取出刚才存的long int类型值: ${await FlutterKV.decodeLong("long",1)}");

    print("存一个double类型的92233720369292.92: ${await FlutterKV.encodeDouble("double", 92233720369292.92)}");
    print("取出刚才存的double类型值: ${await FlutterKV.decodeDouble("double", 1)}");

    print("存一个String类型的Flutter MMKV: ${await FlutterKV.encodeString("string", "Flutter MMKV")}");
    print("取出刚才存的String类型值: ${await FlutterKV.decodeString("string", "error")}");

    print("删除key为string的值: ${await FlutterKV.remove("string")}");
    print("是否存储了key为string的值: ${await FlutterKV.containsKey("string")}");

  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      body: new Center(
        child: new Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            new Text(
              'You have pushed the button this many times:',
            new Text(
              style: Theme.of(context).textTheme.display1,
      floatingActionButton: new FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: new Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_kv: ^0.0.5

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_kv/flutter_kv.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-1 points)

16 out of 16 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/flutter_kv.dart.

Run flutter format to format lib/flutter_kv.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8