5#include "flutter/fml/synchronization/sync_switch.h"
17 false_handler = handler;
39 for (
Observer* observer : observers_) {
40 observer->OnSyncSwitchUpdate(
value);
46 if (
std::find(observers_.begin(), observers_.end(), observer) ==
48 observers_.push_back(observer);
54 observers_.erase(
std::remove(observers_.begin(), observers_.end(), observer),
static sk_sp< Effect > Create()
int find(T *array, int N, T item)
Observes changes to the SyncSwitch.
void AddObserver(Observer *observer) const
Threadsafe.
SyncSwitch(bool value=false)
void RemoveObserver(Observer *observer) const
Threadsafe.
void Execute(const Handlers &handlers) const
void SetSwitch(bool value)
Dart_NativeFunction function
Represents the 2 code paths available when calling |SyncSwitch::Execute|.
std::function< void()> false_handler
Handlers & SetIfFalse(const std::function< void()> &handler)
Sets the handler that will be executed if the |SyncSwitch| is false.
Handlers & SetIfTrue(const std::function< void()> &handler)
Sets the handler that will be executed if the |SyncSwitch| is true.
std::function< void()> true_handler