How ebbot-ai/ebbot_flutter_ui works
Project type and purpose
• This repository is a Flutter plugin package named “Ebbot Flutter UI” together with a demo Flutter app.
• Its purpose is to provide a drop-in chat widget that encapsulates business logic from the ebbot-dart-client library and renders it using the flutter-chat-ui package.
File structure
• Top-level directories:
• lib/v1 – the Dart code for the plugin, organized into subpackages:
– configuration (data models and configuration objects)
– controller (API controller)
– src/controller (state-management controllers)
– src/service (services that drive chat, callback, logging, support, etc.)
– src/parser (message/chat parsers)
– src/initializer (dependency initialization, service locator)
– src/util (utilities, extensions)
– src/widget (UI widget implementations)
• Platform folders – standard Flutter embedding code for Android, iOS, Web, Linux, macOS, Windows.
• docs – markdown documentation.
• Root files – configuration (pubspec.yaml, CI scripts, README).
Extract architecture details from README
• The plugin wraps two key dependencies:
• flutter-chat-ui for UI rendering
• ebbot-dart-client for business logic and communication with Ebbot backend
• A demo app shows how to wire up the widget in a real Flutter project.
Main components
a. Demo Flutter App (your host application)
b. Flutter Engine & Platform Embedder
c. Ebbot Flutter UI plugin, subdivided into layers:
• Presentation/UI Layer: widgets under lib/v1/src/widget
• State/Controller Layer: controllers under lib/v1/controller and lib/v1/src/controller
• Service Layer: classes under lib/v1/src/service
• Parser Layer: under lib/v1/src/parser
• Initialization/DI Layer: under lib/v1/src/initializer using a service locator
• Configuration/Model Layer: under lib/v1/configuration
• Utility Layer: under lib/v1/src/util
d. External Dependencies:
• flutter-chat-ui package (UI library)
• ebbot-dart-client library (chat logic)
e. External Ebbot Chat Service (REST/WebSocket API backend)
Relationships and interactions
• The Demo App imports the plugin and passes a configuration object into the top-level Chat widget.
• The Chat widget invokes the Controller layer, which in turn uses Service classes.
• Service classes delegate message formatting/parsing to the Parser layer, and handle callbacks to the host via ebbot_callback_service.
• Services rely on ebbot-dart-client to perform HTTP/WebSocket calls to the remote Ebbot Chat Service.
• The UI layer draws messages using flutter-chat-ui.
• The Initialization layer wires up dependencies at startup (service locator).
Architectural patterns and design principles
• Layered architecture separating UI, controllers, services, parsers, and models.
• Dependency Injection via a simple Service Locator.
• MVC/MVVM-style separation: widgets (View), controllers (ViewModel), services (Model/Business Logic).
• Cross-platform support via the standard Flutter Engine + platform embedder.