Initializing Core Kit SFA Flutter SDK
After Installation, the next step to use Web3Auth SFA Flutter is to Initialize the SDK and is achieved by init()
function. This step requires
passing various parameters that align with your project preferences. It's important to note that the initialization process is critical to the
successful use of Web3Auth SFA Flutter.
Arguments
Construct and configure the init function with the params as follows
Web3AuthNetwork
- Table
- Class
Parameter | Description |
---|---|
network | The Web3auth network to be used by the SDK. Supported values are TorusNetwork.mainnet , TorusNetwork.testnet , TorusNetwork.cyan , TorusNetwork.aqua |
class Web3AuthNetwork {
final TorusNetwork network;
Web3AuthNetwork({required this.network});
Map<String, dynamic> toJson() {
return {
'network': network.name,
};
}
}
enum TorusNetwork { mainnet, testnet, cyan, aqua }
Using the init()
function
Initialize the Web3AuthFlutter
plugin at the very beginning such as in the overriden initState
function
Usage
import 'package:single_factor_auth_flutter/single_factor_auth_flutter.dart';
final _singleFactorAuthFlutterPlugin = SingleFactAuthFlutter();
Future<void> init() async {
await _singleFactorAuthFlutterPlugin.init(
Web3AuthNetwork(network: torusNetwork),
);
}