Flutter Engine
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 337 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 338 of file dart_converter.h.

References tonic::LogIfError().

Referenced by tonic::DartConverter< std::vector< T > >::ToDart().

338  {
339  bool is_nullable = false;
340  auto is_nullable_handle = ::Dart_IsNullableType(type_handle, &is_nullable);
341  if (LogIfError(is_nullable_handle)) {
342  return is_nullable_handle;
343  }
344  if (is_nullable) {
345  auto list = ::Dart_NewListOfType(type_handle, length);
346  LogIfError(list);
347  return list;
348  } else {
349  auto sentinel = CreateZeroInitializedDartObject<T>(type_handle);
350  if (LogIfError(sentinel)) {
351  return sentinel;
352  }
353  auto list = ::Dart_NewListOfTypeFilled(type_handle, sentinel, length);
354  LogIfError(list);
355  return list;
356  }
357  return ::Dart_Null();
358  }
size_t length
bool LogIfError(Dart_Handle handle)
Definition: dart_error.cc:15

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