useful_classes 1.0.0

  • Readme
  • Changelog
  • Installing
  • 43

useful_classes #

Package with useful classes to make it easy to create other features

import 'package:useful_classes/useful_classes.dart';

State Management Classes #

ValueProvider / ValueConsumer #

Simple class to notify listeners when value is changed.

ValueProvider<String> description = ValueProvider(initialValue: 'Initial Description');

You can modify value setting property 'value' or calling method 'setValue'.

description.value = 'Another Description';
description.setValue('Another Description');

Example to consume this value. In this case, when changing the description value, the Text Widget is rebuilt and shows the new value.

  provider: description,
  builder: (context, value) => Text(value)

ValuesProvider / ValuesConsumer #

Controlling multiple values and ValueProvider.

In the bellow example , is declared 'packageInfo' with the values 'name' os type String and value 'version' of type ValueProvider

ValuesProvider packageInfo = ValuesProvider({
  'name': 'package_name',
  'version': ValueProvider<String>(initialValue: ''),

To update the values on ValuesProvider use 'setValues' method passing a Map<String, dynamic>, and to update a single value, use 'setValue' with 'fieldName' and 'newValue' arguments.

  'name': 'module_provider',
  'version': '1.0.0'

Example for consume all values of the ValuesProvider.

  provider: packageInfo,
  builder: (context, values) => Column() {
    childs: Widget[] {

Example for consume a ValueProvider in the ValuesProvider.

    provider: packageInfo.getValueProvider('version'),
    builder: (context, value) => Text(value)

1.0.0 #

  • Added ValueProvider, ValuesProvider, ListProvider with your consumers.
  • Removed ValueBloc and ValuesBloc.

0.0.3 #

  • Removed ValueModel, ValuesModel

0.0.2 #

  • Added ValueModel, ValuesModel

0.0.1 #

  • Initial version

Use this package as a library

1. Depend on it

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

  useful_classes: ^1.0.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:useful_classes/useful_classes.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 Jun 5, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Health issues and suggestions

Fix lib/providers/value_consumer.dart. (-9.75 points)

Analysis of lib/providers/value_consumer.dart reported 2 warnings:

line 33 col 32: The parameter 'builder' is required.

line 33 col 32: The parameter 'provider' is required.

Format lib/patterns/disposable.dart.

Run flutter format to format lib/patterns/disposable.dart.

Format lib/providers/consumer.dart.

Run flutter format to format lib/providers/consumer.dart.

Fix additional 6 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/providers/list_consumer.dart (Run flutter format to format lib/providers/list_consumer.dart.)
  • lib/providers/list_provider.dart (Run flutter format to format lib/providers/list_provider.dart.)
  • lib/providers/value_provider.dart (Run flutter format to format lib/providers/value_provider.dart.)
  • lib/providers/values_consumer.dart (Run flutter format to format lib/providers/values_consumer.dart.)
  • lib/providers/values_provider.dart (Run flutter format to format lib/providers/values_provider.dart.)
  • lib/useful_classes.dart (Run flutter format to format lib/useful_classes.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

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

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and useful_classes.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
rxdart ^0.22.0 0.22.6 0.24.1
scoped_model ^1.0.1 1.0.1
Transitive dependencies
collection 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
pedantic ^1.8.0