babble_sdk 0.0.7 copy "babble_sdk: ^0.0.7" to clipboard
babble_sdk: ^0.0.7 copied to clipboard

outdated

Babble SDK for survey.

example/lib/main.dart

import 'package:babble_sdk/babble_sdk.dart';
import 'package:flutter/material.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  // BabbleUtils().initBabble();
  BabbleSdk().init(userId: "TiHprDYCQy9UANrWWcA3");
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    BabbleSdk().setCustomerId(customerId: "flut200");
    // BabbleUtils().setCustomerId(customerId: "flut200");
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: TextButton(
              onPressed: () {
                BabbleSdk().triggerSurvey(trigger: "test-template");
                // BabbleUtils().triggerSurvey(trigger: "test-template");
              },
              child: const Text('Trigger survey')),
        ),
      ),
    );
  }
}