Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions splitio/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:splitio/splitio.dart';

/// Replace these with valid values
const String _apiKey = 'api-key';
const String _sdkKey = 'sdk-key';
const String _matchingKey = 'user-id';

void main() {
Expand All @@ -21,12 +21,12 @@ class SplitioExampleApp extends StatefulWidget {
}

class _SplitioExampleAppState extends State<SplitioExampleApp> {
String _splitName = '';
String _featureFlagName = '';
bool _sdkReady = false;
bool _sdkReadyFromCache = false;
late SplitClient _client;

final Splitio _split = Splitio(_apiKey, _matchingKey,
final Splitio _split = Splitio(_sdkKey, _matchingKey,
configuration: SplitConfiguration(
trafficType: "user",
));
Expand Down Expand Up @@ -87,20 +87,20 @@ class _SplitioExampleAppState extends State<SplitioExampleApp> {
Padding(
padding: const EdgeInsets.fromLTRB(32, 8, 32, 8),
child: TextField(
decoration:
const InputDecoration(hintText: 'Enter split name'),
decoration: const InputDecoration(
hintText: 'Enter feature flag name'),
onChanged: (text) {
setState(() {
_splitName = text;
_featureFlagName = text;
});
},
),
),
Visibility(
visible: _splitName != '',
visible: _featureFlagName != '',
child: ElevatedButton(
onPressed: performEvaluation,
child: Text('Evaluate: $_splitName')),
child: Text('Evaluate: $_featureFlagName')),
),
Visibility(
visible: _sdkReady || _sdkReadyFromCache,
Expand Down Expand Up @@ -131,9 +131,8 @@ class _SplitioExampleAppState extends State<SplitioExampleApp> {
}

void performEvaluation() async {
_client
.getTreatment(_splitName)
.then((value) => {print('Evaluation value for $_splitName is $value')});
_client.getTreatment(_featureFlagName).then(
(value) => {print('Evaluation value for $_featureFlagName is $value')});
}

void track() {
Expand Down
4 changes: 2 additions & 2 deletions splitio_platform_interface/lib/split_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class SplitConfiguration {

/// Initializes the Split configuration.
///
/// [featuresRefreshRate] the SDK polls Split servers for changes to feature splits at this rate (in seconds).
/// [featuresRefreshRate] the SDK polls Split servers for changes to feature flags at this rate (in seconds).
///
/// [segmentsRefreshRate] The SDK polls Split servers for changes to segments at this rate (in seconds).
///
Expand All @@ -31,7 +31,7 @@ class SplitConfiguration {
///
/// [impressionListener] Enables impression listener. If true, generated impressions will be streamed in the impressionsStream() method of Splitio.
///
/// [syncConfig] Use it to filter specific splits to be synced and evaluated by the SDK. If not set, all splits will be downloaded.
/// [syncConfig] Use it to filter specific feature flags to be synced and evaluated by the SDK. If not set, all feature flags will be downloaded.
SplitConfiguration({
int? featuresRefreshRate,
int? segmentsRefreshRate,
Expand Down