flutter_mdata 1.0.1 copy "flutter_mdata: ^1.0.1" to clipboard
flutter_mdata: ^1.0.1 copied to clipboard

discontinuedreplaced by: monedata
outdated

A new flutter plugin project.

example/lib/main.dart

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

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  void requestListener(bool request) {
    print(request);
  }

  void isSDKReady(bool isReady) {
    if (isReady) {
      MoneDataSDK.instance.request();
    }
  }

  void consentRemovedListener(bool consent) {
    print(consent);
  }

  void consentAddedListener(bool consent) {
    print(consent);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
            child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            RaisedButton(
              child: Text("Init SDK"),
              onPressed: () {
                MoneDataSDK.instance.init(apiToken: 'api_token');
                MoneDataSDK.instance.addListener();
                MoneDataSDK.instance
                    .setRemoveConsentListener(consentRemovedListener);
                MoneDataSDK.instance.setConsentListener(consentAddedListener);
                MoneDataSDK.instance.setisReadyListener(isSDKReady);
                MoneDataSDK.instance.setRequestOnceListener(requestListener);
              },
            ),
          ],
        )),
      ),
    );
  }
}