How flutterwtf/survey_sdk works
Project Type and Purpose
• This is a mono-repo containing two primary Flutter Dart packages and associated tooling:
• admin – A Flutter-based authoring UI (web/desktop) for building and exporting survey definitions (JSON).
• core (survey_sdk) – A standalone Flutter SDK providing reusable survey widgets, BLoC/Cubit controllers, data mappers, and domain entities for integration into client apps.
• There is also a core/example Flutter app that demonstrates embedding the survey_sdk. CI scripts and GitHub workflows live at the repo root.
File Structure Analysis and Architectural Patterns
• Top-level:
• .github/workflows – CI pipelines for admin, core, examples, code quality checks.
• scripts – Shell scripts for coverage and pub points checks.
• admin package:
• lib/data → data sources interfaces + web implementations (filesystem, session storage)
• lib/data/repositories → repository implementations
• lib/domain/repository_interfaces → domain-level contracts
• lib/presentation → Flutter UI organized by pages, cubits (BLoC pattern), widgets, theming, DI injector
• core package (survey_sdk):
• lib/src/data → data sources, mappers for survey JSON, theme JSON, actions
• lib/src/data/repositories → survey data repository impl
• lib/src/domain → entities, repository interfaces, utils
• lib/src/presentation → survey_controller (Cubit), question pages, widgets, localization, DI
• example/… → demonstration app showing SDK integration.
• Architectural patterns:
• Layered architecture (Data → Domain → Presentation)
• Repository pattern, Data mappers, Dependency Injection
• State management via Flutter BLoC/Cubit
• Modular packages (admin vs. core)
Key README Insights
• survey_sdk features customizable forms, multiple question types, theme support, i18n, analytics integration (Google/Firebase), import/export JSON.
• The admin package complements survey_sdk by authoring JSON definitions.
a. Main Components:
• Repository Root: CI/CD scripts & workflows
• Admin Package (Flutter Web/Desktop)
• Core Package (survey_sdk)
• Example App (uses survey_sdk)
• External Services: File System, Session Storage, Google Analytics/Firebase Analytics
b. Relationships and Interactions:
• Admin UI ↔ DI Injector ↔ Cubits (builder, new_question) ↔ Domain Repos ↔ Data Sources (filesystem, session storage) ←→ Local Storage / Web Storage
• Core SDK → DI Injector → SurveyCubit / SurveyController → Survey pages/widgets → calls SurveyDataRepository → Data Mappers → DataSource (filesystem)
• Example App imports core SDK and invokes SurveyWidget
• Both admin and core optionally emit analytics events to external Analytics services
c. Architectural Patterns/Principles:
• BLoC/Cubit for state management
• Layered separation: Data, Domain, Presentation
• Dependency Injection for swapping data sources (web vs. mobile)
• Repository & Mapper patterns isolating JSON & entity transformations
d. Relevant Technologies:
• Flutter & Dart
• BLoC/Cubit (flutter_bloc)
• JSON serialization / arb files for localization
• Web storage APIs, SessionStorage, FileSystem API
• Google/Firebase Analytics SDKs