thoaded 0.1.0 copy "thoaded: ^0.1.0" to clipboard
thoaded: ^0.1.0 copied to clipboard

Library for simple and fast design pattern that extends model, view and controller for asynchronous events in supported modern programming languages.

example/main.dart

import 'dart:async';
import 'package:thoaded/thoaded.dart';

class SampleMoldeled extends Modeled<String> {
  @override
  Future<String> added(String text) {
    return Future.value(text);
  }

  @override
  Future<String> updated(String text) {
    return Future.value(text);
  }

  @override
  Future<String> deleted(String text) {
    return Future.value(text);
  }

  @override
  Future<String> readed(String text) {
    return Future.value(text);
  }

  @override
  Future<Iterable<String>> queried([String texts]) {
    return Future.value([texts]);
  }

  @override
  Future<void> listened([String texts]) {
    return Future.value();
  }

  @override
  Future<String> unlistened([String texts]) {
    return Future.value();
  }
}

class SampleViewed extends Viewed<String> {
  @override
  Future<String> added(String text) {
    return Future.value(text);
  }

  @override
  Future<String> updated(String text) {
    return Future.value(text);
  }

  @override
  Future<String> deleted(String text) {
    return Future.value(text);
  }

  @override
  Future<String> readed(String text) {
    return Future.value(text);
  }

  @override
  Future<Iterable<String>> queried([String texts]) {
    return Future.value([texts]);
  }

  @override
  Future<void> listened([String texts]) {
    return Future.value();
  }

  @override
  Future<String> unlistened([String texts]) {
    return Future.value();
  }
}

class SampleControlled extends Controlled<String> {
  // run constructor in parent class
  SampleControlled() : super(new SampleMoldeled(), new SampleViewed()) {
    // dispatch read event in modeled listener
    this.modeled.readed("Hello, World!").then((text) {
      // dispatch read event to viewed listener
      this.viewed.readed(text).then((text) {
        // print successfully
        print("Print " + text + " successfully.");
      });
    });
  }
}

void main() {
  SampleControlled();
}
1
likes
35
points
45
downloads

Publisher

unverified uploader

Weekly Downloads

Library for simple and fast design pattern that extends model, view and controller for asynchronous events in supported modern programming languages.

Homepage

Documentation

Documentation

License

MIT (license)

Dependencies

async, flutter, meta

More

Packages that depend on thoaded