flutter_1flow_sdk 1.2.8 copy "flutter_1flow_sdk: ^1.2.8" to clipboard
flutter_1flow_sdk: ^1.2.8 copied to clipboard

outdated

1Flow flutter SDK.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:flutter_1flow_sdk/flutter_1flow_sdk.dart';

void main() {
  runApp(MyApp());
  String projectKey = "<Your 1Flow Project Key>";
  OneFlow.configure(projectKey);
  OneFlow.useFont(fontFamily: "Courier New"); //For iOS Only
  OneFlow.useFont(path: "fonts/pacifico.ttf"); // For Android Only
  OneFlow.useFont(fontFamily: "Courier New", path: "fonts/pacifico.ttf"); // For iOS & Android Both
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
                OneFlow.methodchannel.setMethodCallHandler(oneFlowSurveyFinishNotificationHandler);

    initPlatformState();
  }

Future<void> oneFlowSurveyFinishNotificationHandler(MethodCall call) async {
      final String method = call.method;
      dynamic argument = call.arguments;
                  print("oneFlowSurveyFinishNotificationHandler"); 
      switch(method) { 
          case "oneFlowSurveyFinishNotification": {  
            print("oneFlowSurveyFinishNotification: $argument");
          } 
          break; 
          default: { 
            print("Invalid choice"); 
          } 
          break; 
      } 
}
   void recordEvent(){
   try {
        OneFlow.recordEventName('Net Promoter Score', null);
        print('recordEventName: Done');
      } on PlatformException {
      print('recordEventName: error occured');
    }
      }


  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    
    if (!mounted) return;

    setState(() {

    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: TextButton(onPressed: () {recordEvent();}, child: Text("Record Event")),
        ),
      ),
    );
  }
}
3
likes
0
points
611
downloads

Publisher

verified publisher1flow.app

Weekly Downloads

1Flow flutter SDK.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_1flow_sdk