appier_flutter 1.0.0-beta copy "appier_flutter: ^1.0.0-beta" to clipboard
appier_flutter: ^1.0.0-beta copied to clipboard

outdated

Flutter Plugin for Appier Enterprise Solutions. This plugin is intended to be used by any Appier customer. It supports tracking event logs, user profiles and device related data along with Push Notifi [...]

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:appier_flutter/appier_flutter.dart';

void main() {
  runApp(MaterialApp(
    title: 'Named Routes Demo',
    initialRoute: '/',
    routes: {
      '/': (context) => MainApp(),
      '/second': (context) => FeedbackPage(),
    },
  ));
}

class MainApp extends StatefulWidget {
  @override
  _MainAppState createState() => _MainAppState();
}

const APP_ID = "e26e15e9811a398f6b43";
// add your app group before running in iOS
const APP_GROUP = "com.appier";
const APP_UNIVERSAL_LINK = "universal-link";

class _MainAppState extends State<MainApp> {
  @override
  void initState() {
    super.initState();
    AppierFlutter.configure(APP_ID, appGroup: APP_GROUP, isDev: true);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: const Text('Plugin example app'),
            ),
            body: Center(
                child: ListView(
                  padding: const EdgeInsets.all(8),
                  children: <Widget>[
                    Container(
                      height: 44,
                      child: RaisedButton(
                          color: Colors.teal[100],
                          child: new Text("Log Event - product_viewed"),
                          onPressed: () => {
                            AppierFlutter.logEvent("product_viewed",
                                parameters: {
                                  "param1": 2,
                                  "param2": null,
                                  "param3": "appier"
                                })
                          }),
                    ),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[200],
                            child: new Text("Log Event - product_add_to_cart"),
                            onPressed: () => {
                              AppierFlutter.logEvent("product_add_to_cart",
                                  parameters: {
                                    "param1": 2,
                                    "param2": null,
                                    "param3": "appier"
                                  })
                            })),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[100],
                            child: new Text("Log Event - product_purchased"),
                            onPressed: () => {
                              AppierFlutter.logEvent("product_purchased",
                                  parameters: {
                                    "param1": 2,
                                    "param2": null,
                                    "param3": "appier"
                                  },
                                  vts: 100,
                                  vtsCurr: "USD")
                            })),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[200],
                            child: new Text("Set UniversalLinkDomains - iOS only"),
                            onPressed: () => {
                              AppierFlutter.setUniversalLinkDomains([]),
                              AppierFlutter.setUniversalLinkDomains(
                                  [APP_UNIVERSAL_LINK])
                            })),
                    Container(
                      height: 44,
                      child: RaisedButton(
                          color: Colors.teal[100],
                          child: new Text("flush log immediately"),
                          onPressed: () => {AppierFlutter.flush()}),
                    ),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[200],
                            child: new Text("Set UserId"),
                            onPressed: () => {
                              AppierFlutter.setUserId(""),
                              AppierFlutter.setUserId("0123456789")
                            })),
                    Container(
                      height: 44,
                      child: RaisedButton(
                          color: Colors.teal[100],
                          child: new Text("Set Name"),
                          onPressed: () => {
                            AppierFlutter.setName(""),
                            AppierFlutter.setName("tester")
                          }),
                    ),
                    Container(
                      height: 44,
                      child: RaisedButton(
                          color: Colors.teal[200],
                          child: new Text("Set FirstName"),
                          onPressed: () => {
                            AppierFlutter.setFirstName(""),
                            AppierFlutter.setFirstName("Gary")
                          }),
                    ),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[100],
                            child: new Text("Set LastName"),
                            onPressed: () => {
                              AppierFlutter.setLastName(""),
                              AppierFlutter.setLastName("Wu")
                            })),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[200],
                            child: new Text("Set City"),
                            onPressed: () => {
                              AppierFlutter.setCity(""),
                              AppierFlutter.setCity("London")
                            })),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[100],
                            child: new Text("Set Email"),
                            onPressed: () => {
                              AppierFlutter.setEmail(""),
                              AppierFlutter.setEmail("test.test@gmail.com")
                            })),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[200],
                            child: new Text("Set PhoneNumber"),
                            onPressed: () => {
                              AppierFlutter.setPhoneNumber(""),
                              AppierFlutter.setPhoneNumber("028865252")
                            })),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[100],
                            child: new Text("Set DayOfBirth"),
                            onPressed: () => {
                              AppierFlutter.setDayOfBirth(0),
                              AppierFlutter.setDayOfBirth(29)
                            })),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[200],
                            child: new Text("Set MonthOfBirth"),
                            onPressed: () => {
                              AppierFlutter.setMonthOfBirth(0),
                              AppierFlutter.setMonthOfBirth(12)
                            })),
                    Container(
                      height: 44,
                      child: RaisedButton(
                          color: Colors.teal[100],
                          child: new Text("Set YearOfBirth"),
                          onPressed: () => {
                            AppierFlutter.setYearOfBirth(12),
                            AppierFlutter.setYearOfBirth(0)
                          }),
                    ),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[200],
                            child: new Text("Set CustomKeyValue"),
                            onPressed: () => {
                              AppierFlutter.setCustomKey("Weight", 100),
                              AppierFlutter.setCustomKey("NickName", false),
                              AppierFlutter.setCustomKey("Height", 169.9),
                              AppierFlutter.setCustomKey("District", "XinYi")
                            })),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[100],
                            child: new Text("Set AttributionWindow"),
                            onPressed: () => {
                              AppierFlutter.setAttributionWindow(100),
                              AppierFlutter.setAttributionWindow(0),
                            })),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[200],
                            child: new Text("Set ClickAttributionWindow"),
                            onPressed: () => {
                              AppierFlutter.setClickAttributionWindow(100),
                              AppierFlutter.setClickAttributionWindow(0),
                            })),
                    Container(
                        height: 44,
                        child: RaisedButton(
                            color: Colors.teal[200],
                            child: new Text("Set ClickAttributionWindow null"),
                            onPressed: () =>
                            {AppierFlutter.setClickAttributionWindow(null)}))
                  ],
                )),
            floatingActionButton: FloatingActionButton(
              onPressed: () {
                // Add your onPressed code here!
                Navigator.pushNamed(context, '/second');
              },
              child: Icon(Icons.feedback),
              backgroundColor: Colors.yellow,
            )));
  }
}

class FeedbackPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Feedback Page"),
      ),
      body: Center(
        child: RaisedButton(
          child: new Text("Log Feedback Event"),
          onPressed: () {
            AppierFlutter.logEvent("feedback");
          },
        ),
      ),
    );
  }
}
4
likes
0
pub points
75%
popularity

Publisher

verified publisherappier.com

Flutter Plugin for Appier Enterprise Solutions. This plugin is intended to be used by any Appier customer. It supports tracking event logs, user profiles and device related data along with Push Notifications and InApp Notifications.

Homepage

License

unknown (license)

Dependencies

dart_style, flutter

More

Packages that depend on appier_flutter