flutter_mdata 1.0.1
flutter_mdata: ^1.0.1 copied to clipboard

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);
              },
            ),
          ],
        )),
      ),
    );
  }
}
0
likes
70
pub points
0%
popularity

Publisher

anavrinapps.com

A new flutter plugin project.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache 2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_mdata