getDisplayRuleByName function

Future<MPDisplayRule?> getDisplayRuleByName(
  1. String name
)

Retrieve the display rule with a given name.

Requires that loadMapsIndoors has successfully executed.

Implementation

Future<MPDisplayRule?> getDisplayRuleByName(String name) async {
  final typeExists =
      await MapsindoorsPlatform.instance.displayRuleNameExists(name);

  if (typeExists == true) {
    return MapsindoorsPlatform.instance.createDisplayRuleWithName(name);
  }

  final location = await getLocationById(name);
  if (location != null) {
    return getDisplayRuleByLocation(location);
  }

  return null;
}