SC is a library for state and lifecycle management.

Work-In-Progress

Still not ready for production.

Signals

import 'package:sc/sc1.dart'; // import sc1 instead of material/cupertino/widgets
import 'package:sc/signals.dart';

class CounterService {
  final _counter = MutableSignal(0); // just wrap your value in a MutableSignal

  Signal<int> get counter => _counter; // expose a Signal, so just this class can change the value

  void increment() {
    _counter.value++;
  }
}

class CounterWidget extends StatelessWidget {
  final counterService = CounterService();

  CounterWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Text('counter: ${counterService.counter()}'); // call the Signal to get the value
    // your widget will automatically rebuild when the value changes
  }
}