মূল কনটেন্টে যান

ক্লায়েন্ট লাইব্রেরি

ফ্রেমওয়ার্ক অ্যাডাপ্টার

Dart SDK

Flutter ও Dart অ্যাপের জন্য ক্লায়েন্ট: বিশুদ্ধ Dart, কোনো রানটাইম নির্ভরতা নেই, এবং অন্য ক্লায়েন্টরা যা বহন করে সেই একই ইভেন্ট, ফ্ল্যাগ ও ইনবক্স।

যেখানে প্রকাশিত

prodantix_sdk on pub.dev. Pure Dart, with no runtime dependencies.

ইনস্টল

Bash
dart pub add prodantix_sdk

উদাহরণ

Dart
import 'package:prodantix_sdk/prodantix_sdk.dart';

const projectKey = String.fromEnvironment('PRODANTIX_PUBLIC_KEY');

final client = ProdantixClient(
  apiKey: projectKey,
  host: 'https://eu.api.prodantix.com',
);

client.identify('user-123');
client.capture('order.completed', properties: {'total': 42});

final inbox = await client.getInbox();
await client.shutdown();
এই ক্লায়েন্ট মনে রাখে কে এটি ব্যবহার করছে, তাই identify একবারই ডিসটিংক্ট আইডি সেট করে এবং পরের প্রতিটি কল সেই ব্যক্তিকে নিয়েই। সাইন আউটের সময় reset কল করুন।

দূরবর্তী ও স্থানীয় ফ্ল্যাগ

দূরবর্তী যাচাই সার্ভারকে জিজ্ঞাসা করে এবং সেটিই চূড়ান্ত। স্থানীয় যাচাই নিয়মের একটি ক্যাশ করা স্ন্যাপশট প্রসেসের ভিতরেই মূল্যায়ন করে, প্রতি কলে রাউন্ড ট্রিপ ছাড়াই, যা একটি হট পাথের প্রয়োজন।

Dart
// Remote: asks the server, and is the authoritative answer.
if (await client.isFeatureEnabled('new-checkout')) {
  // ...
}

// Local: evaluated in process from a cached snapshot, no round trip per call.
if (await client.isFeatureEnabledLocal('new-checkout', properties: {'plan': 'pro'})) {
  // ...
}

// Every per-flag read records one $feature_flag_called exposure.
final variant = await client.getVariant('new-checkout');
if (variant?['key'] == 'treatment') {
  // ...
}

// A flag targeting a cohort reads this user's memberships from the store;
// pass them yourself to skip the lookup.
if (await client.isFeatureEnabledLocal('members', cohorts: ['<cohort id>'])) {
  // ...
}

কোথায় চলে

এটি মোবাইল ও Dart VM লক্ষ্য করে, আর নেটওয়ার্কে পৌঁছায় dart:io দিয়ে। অন্য যেকোনো প্ল্যাটফর্মে নিজের Transport ও Requester দিন; ক্লায়েন্টের আর কিছুই বদলায় না।

Dart
final client = ProdantixClient(
  apiKey: projectKey,
  host: 'https://eu.api.prodantix.com',
  transport: MyTransport(),
  requester: myRequester,
  // Hold a Socket.IO subscription to flag changes and refetch the snapshot on
  // push, instead of waiting for the 30s poll.
  streamFlags: true,
);