项目作者: Cynnexis

项目描述 :
Provides iterables that implements the ChangeNotifier class.
高级语言: Dart
项目地址: git://github.com/Cynnexis/notifiable_iterables.git
创建时间: 2020-08-11T16:37:07Z
项目社区:https://github.com/Cynnexis/notifiable_iterables

开源协议:Other

下载


notifiable_iterables

Notifiable Iterables CI/CD language: dart sdk: flutter license: BSD

Provides iterables that implements the ChangeNotifier class.

pub.dev: https://pub.dev/packages/notifiable_iterables

GitHub: https://github.com/Cynnexis/notifiable_iterables

API Documentation: https://cynnexis.github.io/notifiable_iterables/

:electric_plug: Getting Started

:hammer_and_pick: Installation

It is recommended to install this package via pub.

To install this package in your project, open the pubspec.yaml, see this section.

Running the Example

The example/ directory contains an Android Studio project that uses notifiable_iterables.
To make it run, open the project using Android Studio to launch the configuration example.

Buttons describing the configuration "example" on Android Studio.

If you don’t have Android Studio, please open a terminal in the example project directory, and execute the following lines:

  1. # Get the dependencies
  2. pub get
  3. # Check that a device is connected to this computer
  4. flutter devices
  5. # Run the example
  6. flutter run

:dart: Usage

The full documentation is available here.

To use this library, you need to import it in your dart file:

  1. import 'package:notifiable_iterables/notifiable_iterables.dart';

Then, you can use the following classes:

  1. NotifiableList<E>: A notifiable list. It has the same functions as List<E>.
  2. NotifiableSet<E>: A notifiable set. It has the same functions as Set<E>.
  3. NotifiableMap<K, V>: A notifiable map. It has the same functions as Map<K, V>.

Those classes can be uses exactly like their iterable equivalent.

Example:

  1. // Create a notifiable list
  2. NotifiableList<int> list = NotifiableList<int>.of(<int>[0, 1, 2, 3]);
  3. print(list[2].toString()); // prints "2"
  4. // Add a listener
  5. list.addListener(() => print("New list: $list"));
  6. // Change the list
  7. list[3] = 4; // Notify the listeners, the console will show the updated list

:building_construction: Build With

:handshake: Contributing

To contribute to this project, please read our CONTRIBUTING.md file.

We also have a code of conduct to help create a welcoming and friendly
environment.

:writing_hand: Authors

Please see the CONTRIBUTORS.md file.

:page_facing_up: License

This project is under the BSD License. Please see the LICENSE.txt file for more detail
(it’s a really fascinating story written in there!)