Lifecycle mixin for data-bound StatefulWidgets. Implement sourceInput; only owned sources are disposed.
| Member / type / return | Meaning |
|---|---|
Object? get sourceInput | List/configuration/instance binding implemented by a custom State. |
List<T> get sourceFallback | Fallback list without a bound source. |
TxDataSource<T>? boundSource | Currently bound source; borrowed instances remain owned by the caller. |
void sourceChanged() | Hook after a bound source changes; override in custom states. |
List<T> get sourceItems | Currently visible bound records. |
void dispose() | Stops queries and listeners; do not use the instance afterward. |
import 'package:flutter/material.dart';
import 'package:tecexpress/tecexpress.dart';
class BoundLabel extends StatefulWidget {
const BoundLabel({super.key, required this.source});
final Object source;
@override
State<BoundLabel> createState() => _BoundLabelState();
}
class _BoundLabelState extends State<BoundLabel>
with TxSourceState<BoundLabel, String> {
@override
Object get sourceInput => widget.source;
@override
Widget build(BuildContext context) => Text(sourceItems.join(', '));
}