addSymbol method

Future<Symbol> addSymbol(
  1. SymbolOptions options, [
  2. Map? data
])

Adds a symbol to the map, configured using the specified custom options.

Change listeners are notified once the symbol has been added on the platform side.

The returned Future completes with the added symbol once listeners have been notified.

Implementation

Future<Symbol> addSymbol(SymbolOptions options, [Map? data]) async {
  final effectiveOptions = SymbolOptions.defaultOptions.copyWith(options);
  final symbol = Symbol(getRandomString(), effectiveOptions, data);
  await symbolManager!.add(symbol);
  notifyListeners();
  return symbol;
}