flutter_lwx_attribution 0.0.7 copy "flutter_lwx_attribution: ^0.0.7" to clipboard
flutter_lwx_attribution: ^0.0.7 copied to clipboard

A Flutter plugin for mobile app attribution tracking, currently supporting Huawei AppGallery attribution with potential for expanding to other channels.

example/lib/main.dart

import 'dart:convert';

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

import 'package:flutter/services.dart';
import 'package:flutter_lwx_attribution/flutter_lwx_attribution.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';

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    var info = await FlutterLwxAttribution.getTrackInfo<HuaweiAttributionInfo>(
        channel: AttributionAdChannel.huawei);
    if (info != null) {
      final jsonStr = jsonEncode(info.toJson());
      print('jsonStr: $jsonStr');
    }

    if (!mounted) return;

    setState(() {
      _platformVersion = info?.callback ?? '';
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on: $_platformVersion\n'),
        ),
      ),
    );
  }
}
0
likes
130
points
53
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for mobile app attribution tracking, currently supporting Huawei AppGallery attribution with potential for expanding to other channels.

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_lwx_attribution