getSeedNodes static method
Gets seed nodes based on configuration preferences.
This is a convenience method that determines the appropriate seed nodes based on P2P settings and provided seed nodes.
Returns:
nullif P2P is disabled- Provided
seedNodesif they are specified - Remote seed nodes if
fetchRemoteis true - Default seed nodes as fallback
Implementation
static Future<List<String>?> getSeedNodes({
List<String>? seedNodes,
bool? disableP2p,
bool fetchRemote = true,
}) async {
// If P2P is disabled, no seed nodes are needed
if (disableP2p == true) {
return null;
}
// Use explicitly provided seed nodes if available
if (seedNodes != null && seedNodes.isNotEmpty) {
return seedNodes;
}
// Fetch remote seed nodes or use defaults
if (fetchRemote) {
final result = await fetchSeedNodes();
return result.seedNodes;
} else {
return getDefaultSeedNodes();
}
}