withJson static method

PortalItem? withJson(
  1. String json, {
  2. required Portal portal,
})

Creates a portal item from the specified JSON string and portal.

Parameters:

  • json — The JSON representation of the portal item.
  • portal — The portal.

Implementation

static PortalItem? withJson(
  String json, {
  required Portal portal,
}) {
  _initializeArcGISEnvironmentIfNeeded();
  final coreJSON = _CString(json);
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_PortalItem_createWithJSON(
      coreJSON.bytes,
      portal._handle,
      errorHandler,
    );
  });
  if (handle == ffi.nullptr) return null;
  final PortalItem object = Item._instanceCache.instanceWith(handle);
  object._portal.cache(portal);
  return object;
}