initialize static method
Initializes the plugin. This must be called before any other method.
If debug
is true, then verbose logging is printed to the console.
To ignore SSL-related errors on Android, set ignoreSsl
to true. This may
be useful when connecting to a test server which is not using SSL, but
should be never used in production.
Implementation
static Future<void> initialize({
bool debug = false,
bool ignoreSsl = false,
}) async {
assert(
!_initialized,
'plugin flutter_downloader has already been initialized',
);
_debug = debug;
final callback = PluginUtilities.getCallbackHandle(callbackDispatcher)!;
await _channel.invokeMethod<void>('initialize', <dynamic>[
callback.toRawHandle(),
if (debug) 1 else 0,
if (ignoreSsl) 1 else 0,
]);
_initialized = true;
}