Flutter SDK
This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.
For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:purplepro/purplepro.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
final _purpleproPlugin = Purplepro();
@override
void initState() {
super.initState();
initPurpleProPlugin();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPurpleProPlugin() async {
_purpleproPlugin.setPartnerIdAndUserId(partnerId: "77010207011", userId: "5842918d-7d0f-4091-ab8b-4a6abfb5bf22");
}
Future<void> startPurplepro() async {
_purpleproPlugin.startBluePine(darkMode: false);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ElevatedButton(
onPressed: () {
startPurplepro();
},
child: const Text('Enabled'),
),
],
),
),
),
);
}
}
Installation Steps:
Use this package as a library
Depend on it
Run this command:
With Flutter:
$ flutter pub add purplepro
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
dependencies:
purplepro: ^0.0.1
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
Import it
Now in your Dart code, you can use:
import 'package:purplepro/purplepro.dart';
flutter, plugin_platform_interface
Packages that depend on conscent.ai
Last updated