PortalItem.withPortalAndItemId constructor
Creates a portal item object using the specified portal and item ID.
The portal item ID can be determined from the URL of the item details web page or the ArcGIS Online map viewer and scene viewer web applications in your portal. The item details page has the following format https://www.arcgis.com/home/item.html?id=\[item_id]. The map viewer has the format https://www.arcgis.com/home/webmap/viewer.html?webmap=\[item_id] or https://www.arcgis.com/apps/mapviewer/index.html?webmap=\[item_id] depending on whether you use the classic map viewer or the new map viewer. The scene viewer has the following format https://www.arcgis.com/home/webscene/viewer.html?webscene=\[item_id]. In all cases, you can use the [item_id] as the ID to instantiate a portal item.
Parameters:
portal
— The portal.itemId
— The item ID.
Implementation
factory PortalItem.withPortalAndItemId(
{required Portal portal, required String itemId}) {
_initializeArcGISEnvironmentIfNeeded();
final coreItemId = _CString(itemId);
final handle = _withThrowingErrorHandler((errorHandler) {
return runtimecore.RT_PortalItem_createWithPortalAndItemId(
portal._handle, coreItemId.bytes, errorHandler);
});
final PortalItem object = Item._instanceCache.instanceWith(handle);
object._portal.cache(portal);
return object;
}