A simple yet elegant Todo application built with Flutter for the frontend and Dart using Celest for the backend. Dive into the world of seamless full-stack development in Dart.
flutter create todo-app
Download Celest from the official website:
start celest
flutter run
npx json-server --watch --port 8000 ./data/db.json
Create your models in:
celest/lib/models
Create functions to interact with your database in:
celest/functions/<filename>
For example, in celest/functions/todo
:
Future<List<Todo>> getTodos() async {
final response = await dio.get("http://localhost:8000/todos");
final todos = (response.data as List).map((e) => Todo.fromMap(e)).toList();
return todos;
}
// Import the generated Celest client
import 'package:celest_backend/client.dart';
void main() {
// Initializes Celest in your Flutter app
celest.init();
runApp(const ProviderScope(child: MyApp()));
}
Future<List<Todo>> _fetchTodo() async {
final todoList = celest.functions.todo.getTodos();
return todoList;
}
This README provides a basic guide to setting up a Todo application with Flutter and Celest, leveraging Dart for a full-stack experience. Happy coding! 🎉