stream_mixin 1.0.3 copy "stream_mixin: ^1.0.3" to clipboard
stream_mixin: ^1.0.3 copied to clipboard

outdated

A simple mixin for adding a stream behaviour to any class object

example/main.dart

import 'package:flutter/material.dart';
import 'package:stream_mixin/stream_mixin.dart';

class AppTagService with StreamMixin<String> {
  AppTagService._();
  static final AppTagService instance = AppTagService._();
}

class CurrentTag extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return StreamBuilder<String>(
      builder: (context, snap) => Text(snap.data ?? 'No tag selected yet.'),
      stream: AppTagService.instance.onChange, //⭐
    );
  }
}

someFunction() {
  AppTagService.instance.update(element: 'COVID-19');
}
6
likes
0
pub points
78%
popularity

Publisher

verified publisherdart.nonstopio.com

A simple mixin for adding a stream behaviour to any class object

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, meta

More

Packages that depend on stream_mixin