registerFutureCall method

void registerFutureCall(
  1. FutureCall<SerializableModel> futureCall,
  2. String name
)

Registers a FutureCall with the manager. This associates a FutureCall implementation with a specific name.

Throws an exception if a future call with the same name is already registered.

If start has been called previously but the scanner hasn't started yet (because there were no registered future calls), this will trigger the scanner to begin scanning for overdue future calls.

Implementation

void registerFutureCall(FutureCall futureCall, String name) {
  if (_futureCalls.containsKey(name)) {
    throw Exception('Added future call with duplicate name ($name)');
  }

  _initializeFutureCall(futureCall, name);

  _futureCalls[name] = futureCall;

  // If start() was called but we deferred starting the scanner,
  // start it now that we have a registered future call.
  if (_hasPendingStart) {
    _hasPendingStart = false;
    _scanner.start();
  }
}