Flutter Engine
The Flutter Engine
Functions
fuchsia::dart Namespace Reference

Functions

void Initialize (zx::channel directory_request, std::optional< zx::eventpair > view_ref)
 Initializes Dart bindings for the Fuchsia application model. More...
 

Function Documentation

◆ Initialize()

void fuchsia::dart::Initialize ( zx::channel  directory_request,
std::optional< zx::eventpair >  view_ref 
)

Initializes Dart bindings for the Fuchsia application model.

Definition at line 103 of file fuchsia.cc.

104 {
106
107 Dart_Handle library = Dart_LookupLibrary(ToDart("dart:fuchsia"));
110 library, fuchsia::dart::NativeLookup, fuchsia::dart::NativeSymbol);
112
113 auto dart_state = tonic::DartState::Current();
114 std::unique_ptr<tonic::DartClassProvider> fuchsia_class_provider(
115 new tonic::DartClassProvider(dart_state, "dart:fuchsia"));
116 dart_state->class_library().add_provider("fuchsia",
117 std::move(fuchsia_class_provider));
118
119 if (directory_request) {
121 library, ToDart("_outgoingServices"),
122 ToDart(zircon::dart::Handle::Create(std::move(directory_request))));
124 }
125
126 if (view_ref) {
128 library, ToDart("_viewRef"),
129 ToDart(zircon::dart::Handle::Create((*view_ref).release())));
131 }
132}
static DartState * Current()
Definition: dart_state.cc:56
static fml::RefPtr< Handle > Create(zx_handle_t handle)
Definition: handle.cc:28
DART_EXPORT Dart_Handle Dart_SetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver resolver, Dart_NativeEntrySymbol symbol)
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_SetField(Dart_Handle container, Dart_Handle name, Dart_Handle value)
GAsyncResult * result
#define FML_CHECK(condition)
Definition: logging.h:85
static Dart_NativeFunction NativeLookup(Dart_Handle name, int argc, bool *auto_setup_scope)
Dart_Handle ToDart(const T &object)
bool CheckAndHandleError(Dart_Handle handle)
Definition: dart_error.cc:33
void Initialize()
Definition: natives.cc:68