Skip to content

Commit c4d3248

Browse files
authored
Update example and Split config (#61)
1 parent c8128cb commit c4d3248

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

splitio/example/lib/main.dart

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:splitio/splitio.dart';
33

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

88
void main() {
@@ -21,12 +21,12 @@ class SplitioExampleApp extends StatefulWidget {
2121
}
2222

2323
class _SplitioExampleAppState extends State<SplitioExampleApp> {
24-
String _splitName = '';
24+
String _featureFlagName = '';
2525
bool _sdkReady = false;
2626
bool _sdkReadyFromCache = false;
2727
late SplitClient _client;
2828

29-
final Splitio _split = Splitio(_apiKey, _matchingKey,
29+
final Splitio _split = Splitio(_sdkKey, _matchingKey,
3030
configuration: SplitConfiguration(
3131
trafficType: "user",
3232
));
@@ -87,20 +87,20 @@ class _SplitioExampleAppState extends State<SplitioExampleApp> {
8787
Padding(
8888
padding: const EdgeInsets.fromLTRB(32, 8, 32, 8),
8989
child: TextField(
90-
decoration:
91-
const InputDecoration(hintText: 'Enter split name'),
90+
decoration: const InputDecoration(
91+
hintText: 'Enter feature flag name'),
9292
onChanged: (text) {
9393
setState(() {
94-
_splitName = text;
94+
_featureFlagName = text;
9595
});
9696
},
9797
),
9898
),
9999
Visibility(
100-
visible: _splitName != '',
100+
visible: _featureFlagName != '',
101101
child: ElevatedButton(
102102
onPressed: performEvaluation,
103-
child: Text('Evaluate: $_splitName')),
103+
child: Text('Evaluate: $_featureFlagName')),
104104
),
105105
Visibility(
106106
visible: _sdkReady || _sdkReadyFromCache,
@@ -131,9 +131,8 @@ class _SplitioExampleAppState extends State<SplitioExampleApp> {
131131
}
132132

133133
void performEvaluation() async {
134-
_client
135-
.getTreatment(_splitName)
136-
.then((value) => {print('Evaluation value for $_splitName is $value')});
134+
_client.getTreatment(_featureFlagName).then(
135+
(value) => {print('Evaluation value for $_featureFlagName is $value')});
137136
}
138137

139138
void track() {

splitio_platform_interface/lib/split_configuration.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class SplitConfiguration {
55

66
/// Initializes the Split configuration.
77
///
8-
/// [featuresRefreshRate] the SDK polls Split servers for changes to feature splits at this rate (in seconds).
8+
/// [featuresRefreshRate] the SDK polls Split servers for changes to feature flags at this rate (in seconds).
99
///
1010
/// [segmentsRefreshRate] The SDK polls Split servers for changes to segments at this rate (in seconds).
1111
///
@@ -31,7 +31,7 @@ class SplitConfiguration {
3131
///
3232
/// [impressionListener] Enables impression listener. If true, generated impressions will be streamed in the impressionsStream() method of Splitio.
3333
///
34-
/// [syncConfig] Use it to filter specific splits to be synced and evaluated by the SDK. If not set, all splits will be downloaded.
34+
/// [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.
3535
SplitConfiguration({
3636
int? featuresRefreshRate,
3737
int? segmentsRefreshRate,

0 commit comments

Comments
 (0)