flutter_1flow_sdk 1.1.3 copy "flutter_1flow_sdk: ^1.1.3" to clipboard
flutter_1flow_sdk: ^1.1.3 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());
  OneFlow.configure('oneflow_prod_ghTA3yOAx9+KfK1Ezdpaf3TcN983BmhlRvDeP4pY4S1RQWpJKlys+7HGFpZ4h1ljwSx++5GTJyzxo6WglmLpJA==',true);
}

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('ExitURLRule', 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: RaisedButton(onPressed: () {recordEvent();}, child: Text("Button")),
        ),
      ),
    );
  }
}