bindable 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 61

Bindable #

Bindable is a state managment library that is powerful and easy to use. It will become extendable in the future and get many useful plugins to do complex tasks in a simple plugin.

Getting Started #

Instead of using the values of your data directly you make every class with mutuable data Bindable by using the mixin with Bindable

For properties use getters and setters like:

int get counter => get("counter", 0);
set counter(int v) => set("counter", v);

Then every property of these Bindable Models will update everywhere in your View automatically when you use a BindingWidget or the Binding Builder to have more granular control.

The classic Flutter counter example:

class MyApp extends BindingWidget with Bindable {
  int get counter => get("counter", 0);
  set counter(int v) => set("counter", v);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      body: Center(child: Text("You have pressed the button $counter times")),
      floatingActionButton: FloatingActionButton(
        onPressed: () => counter++,
        child: Icon(Icons.add),
      ),
    ));
  }
}

In a real world application we would seperate Model, Logic and View.

Todos and Plans #

[ ] toJson and fromJson for automatic JSON Binding

[ ] Plugin System

[ ] implement Flutter Architecture Samples Todo App with Bindable

[ ] much more

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

example/example.dart

import 'package:bindable/bindable.dart';
import 'package:flutter/material.dart';

class MyApp extends BindingWidget with Bindable {
  int get counter => get("counter", 0);
  set counter(int v) => set("counter", v);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      body: Center(child: Text("You have pressed the button $counter times")),
      floatingActionButton: FloatingActionButton(
        onPressed: () => counter++,
        child: Icon(Icons.add),
      ),
    ));
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  bindable: ^0.1.0

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:bindable/bindable.dart';
  
Version Uploaded Documentation Archive
0.1.0 Mar 17, 2019 Go to the documentation of bindable 0.1.0 Download bindable 0.1.0 archive
0.0.1 Mar 17, 2019 Go to the documentation of bindable 0.0.1 Download bindable 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
24
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

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

  • Dart: 2.3.2
  • pana: 0.12.18
  • Flutter: 1.5.4-hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/binding/bindable.dart. (-0.50 points)

Analysis of lib/src/binding/bindable.dart reported 1 hint:

line 10 col 34: Close instances of dart.core.Sink.

Maintenance issues and suggestions

Support latest dependencies. (-5 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency.

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
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test