find 1.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • new58

find #

Simple, performant state management for Flutter.

Usage #

Define a new ID with static Find.add method anywhere in the app (before first build), i.e., in initState() for the HomePage widget:

Find.add(  
  id: "myText",  
  initialState: {  
    "counter": 0,  
  },  
  builder: (Map _state) =>
    Text(_state["counter"].toString()),
);

It takes three arguments: a string id, a Map initialState for the first state, and a builder that will build the Widget from the passed state (_state).

Displaying the Widget is done anywhere in code with Find.byId("myText"). That's it! The only logic you need to worry about is ensuring you call Find.add() before using Find.byId(), and initState overrides are a good place for this.

To dynamically update the value when a button is pressed:

FloatingActionButton(  
  ...
  onPressed: () => FindData.byId("myText").update(
    "counter", // ID
    (_counter) => _counter + 1 // state transition fn
  ),
  ...
)

Note that Find.add must have been called before the Scaffold containing that FloatingActionButton is built. In the Widget building out the Scaffold, just override initState and set up the ID.

Examples #

There is an example located at /example, which is the default Flutter application except the state logic is replaced with Find. The regular Flutter application, as it comes, is located at /example_default for comparison.

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

example/README.md

example #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

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

Use this package as a library

1. Depend on it

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


dependencies:
  find: ^1.1.1

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:find/find.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
21
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
88
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

We analyzed this package on Dec 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.13.1+4
  • Flutter: 1.12.13+hotfix.2

Health issues and suggestions

Document public APIs. (-0.12 points)

32 out of 33 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.

Fix lib/find.dart. (-0.50 points)

Analysis of lib/find.dart reported 1 hint:

line 72 col 40: The member 'setState' can only be used within instance members of subclasses of 'package:flutter/src/widgets/framework.dart'.

Maintenance suggestions

The package description is too short. (-12 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.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
Dev dependencies
flutter_test