Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
tonic::DartListFactory< T, Enable > Struct Template Reference

#include <dart_converter.h>

Static Public Member Functions

static Dart_Handle NewList (Dart_Handle type_handle, intptr_t length)
 

Detailed Description

template<typename T, typename Enable = void>
struct tonic::DartListFactory< T, Enable >

Definition at line 449 of file dart_converter.h.

Member Function Documentation

◆ NewList()

template<typename T , typename Enable = void>
static Dart_Handle tonic::DartListFactory< T, Enable >::NewList ( Dart_Handle  type_handle,
intptr_t  length 
)
inlinestatic

Definition at line 450 of file dart_converter.h.

450 {
451 bool is_nullable = false;
452 auto is_nullable_handle = ::Dart_IsNullableType(type_handle, &is_nullable);
453 if (CheckAndHandleError(is_nullable_handle)) {
454 return is_nullable_handle;
455 }
456 if (is_nullable) {
457 auto list = ::Dart_NewListOfType(type_handle, length);
459 return list;
460 } else {
461 auto sentinel = CreateZeroInitializedDartObject<T>(type_handle);
462 if (CheckAndHandleError(sentinel)) {
463 return sentinel;
464 }
465 auto list = ::Dart_NewListOfTypeFilled(type_handle, sentinel, length);
467 return list;
468 }
470 }
DART_EXPORT Dart_Handle Dart_IsNullableType(Dart_Handle type, bool *result)
DART_EXPORT Dart_Handle Dart_NewListOfTypeFilled(Dart_Handle element_type, Dart_Handle fill_object, intptr_t length)
DART_EXPORT Dart_Handle Dart_Null(void)
DART_EXPORT Dart_Handle Dart_NewListOfType(Dart_Handle element_type, intptr_t length)
size_t length
bool CheckAndHandleError(Dart_Handle handle)
Definition: dart_error.cc:33

The documentation for this struct was generated from the following file: