fluttium_protocol 0.1.0-dev.1 copy "fluttium_protocol: ^0.1.0-dev.1" to clipboard
fluttium_protocol: ^0.1.0-dev.1 copied to clipboard

The protocol for the communication between the runner and the driver of Fluttium

example/main.dart

import 'dart:convert';
import 'dart:io';

import 'package:fluttium_protocol/fluttium_protocol.dart';

void main() {
  // Emitting data for the listener.
  Emitter()
    ..announce('stepName')
    ..start('stepName')
    ..store('fileName', [1, 2, 3])
    ..done('stepName');

  // Listening to data from the emitter.
  Listener(_fakeData()).messages.listen((message) {
    stdout.writeln('Received ${message.type} with data: ${message.data}');
  });
}

Stream<List<int>> _fakeData() async* {
  final list = [
    {'type': 'start'},
    {
      'type': 'data',
      'data': r'"{\"type\":\"announce\",\"data\":\"\\\"stepName\\\"\"}"'
    },
    {'type': 'done'},
    {'type': 'start'},
    {
      'type': 'data',
      'data': r'"{\"type\":\"start\",\"data\":\"\\\"stepName\\\"\"}"'
    },
    {'type': 'done'},
    {'type': 'start'},
    {
      'type': 'data',
      'data': r'"{\"type\":\"done\",\"data\":\"\\\"stepName\\\"\"}"'
    },
    {'type': 'done'},
  ];
  for (final data in list) {
    await Future<void>.delayed(const Duration(milliseconds: 500));
    yield utf8.encode('${json.encode(data)}\n');
  }
}
1
likes
0
pub points
24%
popularity

Publisher

verified publisherfluttium.dev

The protocol for the communication between the runner and the driver of Fluttium

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (LICENSE)

Dependencies

equatable, meta, yaml

More

Packages that depend on fluttium_protocol