Flutter Engine
The Flutter Engine
dart_class_provider.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
8#include "tonic/dart_state.h"
10
11namespace tonic {
12
14 const char* class_name) {
15 library_.Set(dart_state, Dart_LookupLibrary(ToDart(class_name)));
16}
17
19
21 Dart_Handle name_handle = ToDart(class_name);
22 Dart_Handle class_handle =
23 Dart_GetNonNullableType(library_.value(), name_handle, 0, nullptr);
24 TONIC_DCHECK(!Dart_IsError(class_handle));
25 return class_handle;
26}
27
28} // namespace tonic
DartClassProvider(DartState *dart_state, const char *library_name)
Dart_Handle GetClassByName(const char *class_name)
void Set(DartState *dart_state, Dart_Handle value)
Dart_PersistentHandle value() const
DART_EXPORT Dart_Handle Dart_GetNonNullableType(Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
const char *const class_name
Dart_Handle ToDart(const T &object)
#define TONIC_DCHECK
Definition: macros.h:32