flutter_1flow_sdk 1.0.9 copy "flutter_1flow_sdk: ^1.0.9" to clipboard
flutter_1flow_sdk: ^1.0.9 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('<your_project_key>',true);
}

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

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

   void recordEvent(){
   try {
         OneFlow.recordEventName('custom', 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")),
        ),
      ),
    );
  }
}