plugins 0.2.0 copy "plugins: ^0.2.0" to clipboard
plugins: ^0.2.0 copied to clipboard

outdated

A simple plugin loading system

example/plugins.dart

import 'package:plugins/loader.dart';
import 'dart:io';

void main() {
  PluginManager pm = new PluginManager();
  Directory path = new Directory("example" + Platform.pathSeparator + "plugins");

  pm.loadAll(path).then((List<Plugin> plugins) {
    print("Plugins registered: ${plugins}");

    pm.listenAllRequest((String plugin, Request req) {
      print("Received request from '$plugin' for command '${req.command}'");
      req.reply({0: 'Isn\'t this just awesome?'});
    });

    pm.listenAll((name, data) {
      print("Received data from plugin '$name': ${data[0]}");
      if (data[0] == "KILL") {
        print("Killing $name");
        pm.kill(name);
      }
    });

    pm.sendAll({0: "Hello from loader!"});
    pm.get("Requester", "loader-command", {});
  });
}
1
likes
0
points
3
downloads

Publisher

unverified uploader

Weekly Downloads

A simple plugin loading system

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

path, yaml

More

Packages that depend on plugins