web2wave 1.0.0 copy "web2wave: ^1.0.0" to clipboard
web2wave: ^1.0.0 copied to clipboard

Web2Wave is a lightweight Flutter package that provides a simple interface for managing user subscriptions and properties through a REST API.

example/web2wave_example.dart

import 'package:web2wave/web2wave.dart';
import 'package:dotenv/dotenv.dart';

void main() async {
  var env = DotEnv()..load();
  String apiKey = env['API_KEY'] ?? 'default_value';
  String userID = env['USER_ID'] ?? 'default_value';
  print('API Key: $apiKey \nUserID: $userID');

  Web2Wave.shared.initialize(apiKey: apiKey);

  final subscriptions =
      await Web2Wave.shared.fetchSubscriptions(web2waveUserId: userID);
  print('subscriptions: $subscriptions');

  final isActive =
      await Web2Wave.shared.hasActiveSubscription(web2waveUserId: userID);
  print('isActive: $isActive');

  final properties =
      await Web2Wave.shared.fetchUserProperties(web2waveUserId: userID);
  print('User properties: ($properties)');

  final result = await Web2Wave.shared.updateUserProperty(
      web2waveUserId: userID, property: 'preferredTheme', value: 'dark');
  switch (result.isSuccess) {
    case true:
      print('Property updated successfully');
    case false:
      print('Failed to update property with error - ${result.errorMessage}');
  }

  final resultAdapty = await Web2Wave.shared.setAdaptyProfileID(
      web2waveUserId: userID, adaptyProfileId: "{adaptyProfileID}");
  switch (resultAdapty.isSuccess) {
    case true:
      print('Adapty profileID saved');
    case false:
      print(
          'Failed to save Adapty profileID with error - ${result.errorMessage}');
  }

  final resultRevcat = await Web2Wave.shared.setRevenuecatProfileID(
      web2waveUserId: userID, revenuecatProfileId: "{revenueCatProfileID}");
  switch (resultRevcat.isSuccess) {
    case true:
      print('RevenueCat profileID saved');
    case false:
      print(
          'Failed to save RevenueCat profileID with error - ${result.errorMessage}');
  }

  final resultQonversion = await Web2Wave.shared.setQonversionProfileID(
      web2waveUserId: userID, qonverionProfileId: "{qonversionProfileID}");
  switch (resultQonversion.isSuccess) {
    case true:
      print('Qonversion profileID saved');
    case false:
      print(
          'Failed to save Qonversion profileID with error - ${result.errorMessage}');
  }
}
1
likes
0
points
309
downloads

Publisher

unverified uploader

Weekly Downloads

Web2Wave is a lightweight Flutter package that provides a simple interface for managing user subscriptions and properties through a REST API.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http

More

Packages that depend on web2wave