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

outdated

Detect from where your application was installed (Google Play, App Store, TestFlight…)

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Installation Referrer plugin example app'),
        ),
        body: Center(
          child: FutureBuilder(
            future: InstallReferrer.referrer,
            builder: (BuildContext context,
                AsyncSnapshot<InstallationAppReferrer> result) {
              if (!result.hasData) {
                return const CircularProgressIndicator.adaptive();
              } else if (result.hasError) {
                return const Text('Unable to detect your referrer');
              } else {
                return Text(
                  'Referrer:\n${toReadableString(result.data!)}',
                  textAlign: TextAlign.center,
                );
              }
            },
          ),
        ),
      ),
    );
  }

  String toReadableString(InstallationAppReferrer referrer) {
    switch (referrer) {
      case InstallationAppReferrer.iosAppStore:
        return "Apple - App Store";
      case InstallationAppReferrer.iosTestFlight:
        return "Apple - Test Flight";
      case InstallationAppReferrer.iosDebug:
        return "Apple - Debug";
      case InstallationAppReferrer.androidGooglePlay:
        return "Android - Google Play";
      case InstallationAppReferrer.androidAmazonAppStore:
        return "Android - Amazon App Store";
      case InstallationAppReferrer.androidSamsungAppShop:
        return "Android - Samsung App Shop";
      case InstallationAppReferrer.androidManually:
        return "Android - Manual installation";
      case InstallationAppReferrer.androidDebug:
        return "Android - Debug";
    }
  }
}
56
likes
0
pub points
89%
popularity

Publisher

verified publisherdaad.mobi

Detect from where your application was installed (Google Play, App Store, TestFlight…)

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on install_referrer