getAllPlugins method

Future<List> getAllPlugins()

Implementation

Future<List<dynamic>> getAllPlugins() async {
  try {
    var totalModules = await contract.call("getModulesPaginated",
        ["0x0000000000000000000000000000000000000001", BigInt.from(100)]);
    // total modules is a list with two elements, the first element is a list of plugin addresses and the second element is the module address at beginning of next page
    List moduleAddresses = totalModules[0];
    String nextModuleAddress = totalModules[1];
    while (
        nextModuleAddress != "0x0000000000000000000000000000000000000001") {
      var totalModules = await contract
          .call("getModulesPaginated", [nextModuleAddress, BigInt.from(100)]);
      // total modules is a list with two elements, the first element is a list of plugin addresses and the second element is the module address at beginning of next page
      moduleAddresses.addAll(totalModules[0]);
      nextModuleAddress = totalModules[1];
    }
    return moduleAddresses;
  } on Exception catch (e) {
    throw Exception("Could not get all plugins");
  }
}