getFile method
Fetches the entire Figma file data.
Returns a JSON object containing all file data including:
- Document structure
- Components
- Styles
- Variables
Implementation
Future<Map<String, dynamic>> getFile() async {
final response = await http.get(
Uri.parse('$_baseUrl/files/$_fileId'),
headers: {'X-FIGMA-TOKEN': _token},
);
if (response.statusCode == 200) {
return json.decode(response.body);
} else {
throw Exception('Failed to fetch Figma file: ${response.statusCode}');
}
}