{"id":51029932,"url":"https://github.com/formbricks/flutter","last_synced_at":"2026-06-21T23:30:35.644Z","repository":{"id":361836286,"uuid":"1253191726","full_name":"formbricks/flutter","owner":"formbricks","description":"Formbricks Flutter SDK","archived":false,"fork":false,"pushed_at":"2026-06-08T09:07:27.000Z","size":271,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-08T22:00:02.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/formbricks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-29T08:24:04.000Z","updated_at":"2026-06-04T08:48:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/formbricks/flutter","commit_stats":null,"previous_names":["formbricks/flutter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/formbricks/flutter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formbricks%2Fflutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formbricks%2Fflutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formbricks%2Fflutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formbricks%2Fflutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/formbricks","download_url":"https://codeload.github.com/formbricks/flutter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formbricks%2Fflutter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34629658,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-21T23:30:34.823Z","updated_at":"2026-06-21T23:30:35.627Z","avatar_url":"https://github.com/formbricks.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Formbricks Flutter\n\nMonorepo for the first-party **Flutter SDK** for [Formbricks](https://formbricks.com)\nand its demo app. Initialize a workspace, identify users, track actions, and\nrender targeted in-app surveys inside a WebView backed by\n`{appUrl}/js/surveys.umd.cjs`.\n\nSDK usage docs live in\n[`packages/formbricks/README.md`](packages/formbricks/README.md).\n\n## Quick Start\n\nRun commands from the repo root unless a step says otherwise.\n\n### 1. Install platform prerequisites\n\nFVM installs the Flutter SDK for this project, but you still need the native\ntooling for the platform you want to run:\n\n- **iOS simulator:** macOS with Xcode installed. Also run\n  `xcode-select --install` once so command-line tools are available.\n- **Android emulator:** Android Studio with the Android SDK, Platform Tools,\n  and at least one Android Virtual Device (AVD) created in Device Manager.\n\nIf you only plan to run one platform, you only need that platform's tooling.\n\n### 2. Install FVM\n\nFVM reads `.fvmrc` and downloads the exact Flutter version used by this repo.\nOn macOS, Homebrew is the easiest install path:\n\n```bash\nbrew tap leoafarias/fvm\nbrew install fvm\n```\n\nIf you already have Dart on your machine, this also works:\n\n```bash\ndart pub global activate fvm\n```\n\n### 3. Install the pinned Flutter SDK\n\n```bash\nfvm install\nmake doctor\n```\n\n`fvm install` downloads the Flutter version from `.fvmrc` (currently `3.44.0`).\n`make doctor` checks the local iOS/Android tooling with the pinned Flutter SDK.\nFix the red `✗` items for the platform you want to run, then run the doctor\ncommand again.\n\n### 4. Fetch dependencies\n\n```bash\nmake deps\n```\n\nThis resolves the whole Dart pub workspace from the root `pubspec.yaml` and\nuses the shared `pubspec.lock`.\n\n### 5. Run the playground app\n\n```bash\nmake run            # iOS simulator, default\nmake run android    # Android emulator\n```\n\nThe Makefile delegates to `tool/run.sh`, boots a simulator/emulator when it can,\nthen runs `apps/playground`. Once the app is running, press `r` for hot reload,\n`R` for hot restart, and `q` to quit.\n\nYou should see a **\"Welcome to Formbricks\"** header, a connection form\n(App URL + Workspace ID), a \"Trigger Code Action\" button, the identity buttons\n(setUserId / setAttributes / setAttribute / setLanguage / logout), and\nlocal-storage inspect/clear buttons. Connect to a real workspace to exercise\nthem end to end.\n\n## Repository layout\n\n```\nflutter/\n├── pubspec.yaml                 # pub workspace root + Melos script config (never published)\n├── Makefile                     # daily dev + CI command entry point\n├── analysis_options.yaml        # shared analyzer + lint rules for every package\n├── sonar-project.properties     # SonarCloud config (finalised in a follow-up)\n├── LICENSE                      # MIT\n├── packages/\n│   └── formbricks/      # the SDK package (the thing we publish)\n│       ├── lib/\n│       │   ├── formbricks.dart   # public exports\n│       │   └── src/                       # private implementation\n│       ├── test/                          # one test file per source file\n│       ├── pubspec.yaml\n│       ├── CHANGELOG.md\n│       ├── LICENSE\n│       └── README.md\n└── apps/\n    └── playground/              # demo / manual-QA app\n        ├── lib/main.dart        # SDK test buttons: track, setUserId, setAttributes, …\n        ├── android/  ios/       # platform projects (iOS + Android only)\n        ├── test/\n        └── pubspec.yaml\n```\n\nA standard `packages/*` + `apps/*` monorepo split.\n\n### Why these locations\n\n| Path                  | Holds               | Rationale                                                                                                                                                                                                                                  |\n| --------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `packages/formbricks` | The publishable SDK | Single source of the pub.dev package. `src/` is private; only `lib/formbricks.dart` re-exports the public API.                                                                                                                             |\n| `apps/playground`     | Demo app            | Real Flutter app on iOS + Android for manual QA of WebView / keyboard / modal behaviour. Excluded from SonarCloud + pub scoring. A real demo app is what catches keyboard/touch regressions before customers do, so it ships from day one. |\n\n## Monorepo tooling\n\nUses **Dart pub workspaces** (Dart ≥ 3.6) + **[Melos](https://melos.invertase.dev) 7**.\n\n- The root `pubspec.yaml` declares `workspace:` members. Each member sets\n  `resolution: workspace`, so the whole repo shares **one** lockfile and one\n  resolved dependency graph — no version drift between SDK and demo app.\n- Melos 7 sits on top of native workspaces and adds cross-package scripts\n  (analyze / test / format across everything at once). Its config lives under\n  the `melos:` key in the root `pubspec.yaml` (Melos 7 dropped `melos.yaml`).\n\n### Common commands\n\nAll run from the repo root. Use the Makefile for normal development; it uses\n`fvm flutter` / `fvm dart` when FVM is installed and falls back to `flutter` /\n`dart` from `PATH` otherwise.\n\n```bash\nmake help          # list available targets\nmake deps          # resolve the whole workspace (one lockfile)\nmake format        # format Dart code\nmake format-check  # CI-style formatting check\nmake analyze       # analyze all packages\nmake test          # run tests in packages that have test/\nmake coverage      # run tests with coverage\nmake check         # format-check + analyze + test\n```\n\nImportant daily commands:\n\n```bash\nmake deps\nmake run\nmake run android\nmake format\nmake analyze\nmake test\nmake check\n```\n\nCI/parity targets are also available when you need to reproduce workflow steps:\n\n```bash\nmake deps-lockfile\nmake analyze-ci\nmake test-sdk-machine\nmake test-sdk-coverage\nmake test-playground\nmake build-android\nmake build-ios-no-codesign\nmake pana-install\nmake pana\nmake pub-publish-dry-run\n```\n\n## Conventions\n\nConventions locked in across the SDK:\n\n- **Naming.** Internal types are `FormbricksConfig`, `Logger`, etc. — no\n  redundant `Flutter` prefix inside a Flutter package. Storage key is\n  `formbricks-flutter`, namespaced so multiple Formbricks SDKs on one device\n  never collide.\n- **Static public API, hidden singleton.** `Formbricks.track(...)` /\n  `Formbricks.setup(...)` are static facades over a private singleton — **not**\n  `Formbricks.instance.track(...)`. The host widget and static API share the\n  one `Formbricks` class.\n- **No `environmentId`.** The SDK accepts `workspaceId` only — no legacy alias\n  to ever deprecate.\n- **Dates cross one boundary.** `DateTime` in memory, ISO-8601 `String` on the\n  wire and on disk; convert only in `fromJson` / `toJson`. No stray\n  `DateTime.parse` elsewhere.\n- **Testing is mandatory.** Every source file gets a dedicated test file (happy\n  path + errors + edge cases). PRs aren't mergeable without it; aim for ≥ 80 %\n  coverage on touched files. Unit tests use `flutter_test` + `mocktail` /\n  `http`'s `MockClient` — no real network.\n- **Targets.** iOS + Android only; Flutter Web and desktop are not supported.\n\n## Toolchain details\n\nThe exact Flutter version is pinned in **`.fvmrc`** and managed with\n[fvm](https://fvm.app). Pinning means every contributor and CI run uses the same\nSDK version.\n\n- FVM downloads Flutter into its own cache under `~/fvm/versions/`; you do not\n  clone Flutter by hand.\n- `.fvm/flutter_sdk` is a local symlink to the active SDK and is git-ignored.\n  Only `.fvmrc` is committed.\n- Editors should use `.fvm/flutter_sdk` as the Flutter/Dart SDK path so analysis\n  and code completion use the pinned SDK.\n- Bump the repo's Flutter version with `fvm use \u003cversion\u003e --force`, then commit\n  the changed `.fvmrc`.\n- Floors: published SDK = Flutter ≥ 3.27 / Dart ≥ 3.6; dev tooling pins a newer SDK via `.fvmrc`.\n\n## Running the demo app\n\nThe playground targets **iOS + Android only** — there is no `macos/`/`web/`\nproject. Note that `flutter run` cannot boot a simulator on its own: with no\ndevice running it falls back to the macOS desktop target (which this app does\nnot support), so a simulator/emulator must be started first.\n\n### One-command run\n\n```bash\nmake run            # iOS simulator (default)\nmake run android    # Android emulator\n```\n\nOr call the underlying script directly after `make deps`:\n\n```bash\n./tool/run.sh\n./tool/run.sh android\n```\n\n### Device checks\n\nUse these commands when the run script cannot find a device:\n\n```bash\nmake emulators   # configured simulators/emulators Flutter can launch\nmake devices     # currently running simulators/emulators/devices\n```\n\nFor Android, if no emulator appears in `make emulators`, create an AVD in\nAndroid Studio's Device Manager first.\n\n### Manual CLI run\n\nA simulator/emulator must be booted _first_ — `flutter run` never boots one\nitself. Start a device, then target it by id or name substring:\n\n```bash\nfvm flutter emulators --launch apple_ios_simulator   # iOS sim\n# or: fvm flutter emulators --launch Pixel_9a         # Android emulator\ncd apps/playground\nfvm flutter run -d iphone        # iOS, if the simulator name contains \"iphone\"\nfvm flutter run -d emulator      # Android, if the emulator id contains \"emulator\"\n```\n\n`-d` matches a device id or name substring, not a platform name. For example,\n`-d ios` does not mean \"run on iOS\".\n\nFirst Android build is slow because Gradle downloads the NDK and CMake\n(approximately 3 GB, one-time). Subsequent builds reuse them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformbricks%2Fflutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fformbricks%2Fflutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformbricks%2Fflutter/lists"}