data_tracker

Creator: coderz1093

Last updated:

0 purchases

data_tracker Image
data_tracker Images

Languages

Categories

Add to Cart

Description:

data tracker

A InheritedWidget that simplifies the tracker system share data for Component widget styling, Avoid multi-level parameter penetration .
Features #
Lightweight for Tracking system or Analytics by Firebase etc. Provider a quick access for data of analytics.
Usage #
class Example extends StatelessWidget {
const Example({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return TrackerScope(
params: const {"id": 101},
parentContext: context,
child: const ExampleComponent(),
);
}
}

class ExampleComponent extends StatelessWidget {
const ExampleComponent({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return TrackerScope(
params: const {"name": "brook", "age": "18"},
parentContext: context,
child: Builder(builder: (conetxt) {
final id = Tracker.find(conetxt, "id");
final idOrDefault =
Tracker.findOrDefault(context, 'id', defaultVal: "101");
final filters = Tracker.findMap(conetxt, ['id', 'name']);
final allFilters = Tracker.findAllMap(conetxt, ['id', 'name']);
final currentParams = Tracker.collectSelf(conetxt);
final allParams = Tracker.collect(conetxt);

return Column(
children: [
Text('$id'),
Text('$idOrDefault'),
Text('$filters'),
Text('$allFilters'),
Text('$currentParams'),
Text('$allParams'),
],
);
}),
);
}
}

copied to clipboard
Use for dialog or another Cross-Context Scenes. #
showDialog(
context: context,
builder: (context) {
return TrackerScope(
params: Tracker.collect(context),
child: Container(),
);
},
);

copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.