Wiredash SDK Documentation

repository·stable·Indexed 19 days ago

https://github.com/wiredashio/wiredash-sdk

A Flutter SDK for real-time, GDPR-compliant analytics and in-app user feedback. It enables developers to capture user feedback with screenshots, schedule promoter score surveys (NPS/CSAT), and implement custom themes and localizations. The SDK supports WebAssembly (Wasm) compilation via dart2wasm and includes a wiresdk_sidekick CLI for project maintenance, localization generation, and testing.

Tokens
3.2K
Snippets
18
Records
22
Agent score
68%

What's inside Wiredash SDK

  1. Run the Wiredash Wasm sample

    stable

    Wasm builds require specific COOP/COEP headers to support SharedArrayBuffer. Use the provided serve.py script to host the build with the necessary headers.

    1. Build the project: ../../wiresdk flutter build web --wasm --strip-wasm
    2. Start the server: python3 serve.py 8123
    3. Access the app at http://127.0.0.1:8123/
    ../../wiresdk flutter build web --wasm --strip-wasm
    python3 serve.py 8123
  2. Wrap your root widget with Wiredash

    stable

    To initialize the Wiredash SDK, wrap your application's root widget with the Wiredash widget. You must provide your projectId and SDK secret, which can be found in the Wiredash Console under Your project > Settings > General Settings.

    The Wiredash widget can wrap any root widget, such as MaterialApp or WidgetsApp.

    import 'package:flutter/material.dart';
    import 'package:wiredash/wiredash.dart';
    
    class MyApp extends StatelessWidget {
    
      @override
      Widget build(BuildContext context) {
        return Wiredash(
          projectId: 'YOUR-PROJECT-ID',
          secret: 'YOUR-SECRET',
          child: MaterialApp(
            // Your Flutter app is basically Wiredash's direct child.
          ),
        );
      }
    }
  3. Initialize Wiredash in your Flutter app

    stable

    To start using Wiredash, wrap your application's root widget with the Wiredash widget. You must provide your projectId and SDK secret, which can be found in the Wiredash Console under Your project > Settings > General Settings.

    The Wiredash widget can wrap any root widget, such as MaterialApp or WidgetsApp.

    import 'package:flutter/material.dart';
    import 'package:wiredash/wiredash.dart';
    
    class MyApp extends StatelessWidget {
    
      @override
      Widget build(BuildContext context) {
        return Wiredash(
          projectId: 'YOUR-PROJECT-ID',
          secret: 'YOUR-SECRET',
          child: MaterialApp(
            // Your Flutter app is basically Wiredash's direct child.
          ),
        );
      }
    }
  4. Install the Wiredash SDK

    stable

    To add Wiredash to your Flutter project, use the flutter pub add command or manually add it to your pubspec.yaml file.

    Run the following command in your terminal:

    flutter pub add wiredash:^2.7.0

    Alternatively, update your pubspec.yaml dependencies:

    dependencies:
      flutter:
        sdk: flutter
      ...
      wiredash: ^2.7.0
  5. Customize iOS launch screen assets

    stable

    To change the launch screen image in the iOS version of the example project, you can either replace the image files directly in the LaunchImage.imageset directory or use Xcode to manage the assets.

    Method 1: Direct File Replacement Replace the existing image files within the examples/localization/ios/Runner/Assets.xcassets/LaunchImage.imageset/ directory with your own assets.

    Method 2: Using Xcode

    1. Open the iOS project workspace using the command: open ios/Runner.xcworkspace.
    2. In the Xcode Project Navigator, navigate to Runner/Assets.xcassets.
    3. Drag and drop your desired images into the asset catalog to replace the existing launch screen assets.
    open ios/Runner.xcworkspace
  6. Localize Wiredash using the Localization example

    stable

    The Wiredash localization system allows you to customize the user experience by:

    1. Overriding existing wording: Change the text used by built-in Wiredash components (e.g., button labels or headers).
    2. Adding support for new languages: Extend the SDK to support languages not included by default.
    3. Localizing labels: Ensure all user-facing strings are presented in the user's preferred language.

    To implement this, you typically provide a custom localization implementation to the Wiredash widget configuration.

  7. Add new localizations to existing languages

    stable

    To update or add translations for an existing language:

    1. Open the corresponding .arb file in lib/assets/l10n/.
    2. Use lib/wiredash_en.arb as a template to identify all available translation keys.
    3. Update the keys and values to your liking.

    CRITICAL: Do not edit any .g.dart files manually; these are generated files.

  8. Add a new language to Wiredash

    stable

    To support a new language in the SDK, follow these steps:

    1. Create a new language file in lib/assets/l10n/.
    2. Export the new language file in lib/wiredash.dart to ensure developers can extend it.
    3. Run the localization generation command to convert the .arb files into Dart code.
  9. Compile Wiredash to WebAssembly (Wasm) via dart2wasm

    stable

    To verify that Wiredash and its dependencies are compatible with WebAssembly without relying on dart:html or dart:js fallbacks, use the --strip-wasm flag. This flag ensures that any non-wasm compatible code path results in a hard build error instead of a silent downgrade to JavaScript.

    ../../wiresdk flutter build web --wasm --strip-wasm