SyncEase is a lightweight and versatile state management library for Flutter applications. It provides simple yet powerful tools for managing the state of your application with ease.
- Simple API: SyncEase offers a straightforward API for managing state, making it easy to integrate into your Flutter projects.
- Error Handling: Easily handle errors within your application state and propagate them to your UI.
- Loading State: Manage loading states within your application, providing feedback to users during asynchronous operations.
- Batch Operations: Perform batch operations on your state, allowing you to update multiple values atomically.
- Listener Support: SyncEase supports listeners, allowing you to react to state changes and update your UI accordingly.
- Versatile: Suitable for various types of state management scenarios, including simple value states and list states.
To use SyncEase in your Flutter project, add the following dependency to your pubspec.yaml
file:
dependencies:
sync_ease: ^1.0.0`
Then, run flutter pub get
to install the package.
Here's a simple example of how to use SyncEase to manage state in your Flutter application:
import 'package:sync_ease/sync_ease.dart';
final Ease<int> counter = Ease(0);
EaseBuilder<int>(
ease: counter,
builder: (context, value) => Text(
value.toString(),
style: TextStyle(fontSize: 24),
),
),
counter.value++; // Increment the counter
import 'package:flutter/material.dart';
import 'package:sync_ease/sync_ease.dart';
class CounterLogic extends SyncEaseLogic{
int a=0;
increment(){
a++;
put(); // update Logic Builder Widget
}
}
class MyApp extends StatelessWidget{
final CounterLogic _counterLogic=SyncEaseLogic.reg(CounterLogic());
MyApp({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: (){
_counterLogic.increment();
},
),
body: Center(
child: LogicBuilder(
logic: _counterLogic,
builder: (BuildContext context) {
return Text(_counterLogic.a.toString());
},
)
),
);
}
}
- Simplicity: SyncEase offers a simple and intuitive API, making it easy to manage state in Flutter applications.
- Flexibility: It provides various features like error handling, loading state management, and batch operations, catering to diverse state management needs.
- Efficiency: With its listener support and batch operations, SyncEase ensures efficient state updates and UI rendering.
- Compatibility: SyncEase seamlessly integrates with existing Flutter projects and other state management solutions, allowing for smooth adoption.
- Show Snack Bar, Alert Dialog, and Date Picker Anywhere in the App
You can now use the showSyncSnackBar
, showSyncAlertBox
, and showSyncDatePicker
functions to display snack bars, alert dialogs, and date pickers from anywhere in the app, even outside the widget tree.
showSyncSnackBar(SnackBar(content: Text('Hello, world!')));
showSyncAlertBox(
builder: (BuildContext context) => AlertDialog(
title: Text('Alert'),
content: Text('This is an alert dialog.'),
),
);
showSyncDatePicker(
initialDate: DateTime.now(),
firstDate: DateTime(2022),
lastDate: DateTime(2025),
);
to(SecondPage());
to(SecondPage(),asrguments:{"name":"Jhone"});
back();
For detailed documentation and API reference, visit the SyncEase Documentation.
Contributions to SyncEase are welcome! If you find any bugs or have suggestions for improvements, please open an issue or submit a pull request on GitHub.