start method
Initialize the SDK.
This should be called before using the SDK to evaluate flags. Note that
the SDK requires the flutter bindings to allow use of native plugins for
handling device state and storage. In order to start the SDK before
runApp
is called, you must ensure the binding is initialized with
WidgetsFlutterBinding.ensureInitialized
.
The start function can take an indeterminate amount of time to complete. For instance if the SDK is started while a device is in airplane mode, then it may not complete until some time in the future when the device leaves airplane mode. For this reason it is recommended to use a timeout when waiting for SDK initialization.
For example:
await client.start().timeout(const Duration(seconds: 30));
The waitForNetworkResults
parameters, when true, indicates that the SDK
will attempt to wait for values from LaunchDarkly instead of depending
on cached values. The cached values will still be loaded, but the future
returned by this function will not resolve as a result of those cached
values being loaded. Generally this option should NOT be used and instead
flag changes should be listened to. It the client is set to offline mode,
then this option is ignored.
If waitForNetworkResults
is true, and an error is encountered, then
false may be returned even if cached values were loaded.
Implementation
Future<bool> start({bool waitForNetworkResults = false}) async {
return _client.start(waitForNetworkResults: waitForNetworkResults);
}