fetchNode method

Future<Map<String, dynamic>> fetchNode(
  1. String nodeId
)

Fetches a specific node from the Figma file.

Parameters:

  • nodeId: The ID of the node to fetch

Returns the node's document data. Throws an exception if the node cannot be fetched.

Implementation

Future<Map<String, dynamic>> fetchNode(String nodeId) async {
  final formattedNodeId = nodeId.replaceAll('-', ':');
  final nodeUrl = '$_baseUrl/files/$_fileId/nodes?ids=$formattedNodeId';

  final response = await _makeRequest(nodeUrl);
  return response['nodes'][formattedNodeId]['document'];
}