figma2flutter library Null safety

Figma2Flutter SDK

Library contains functions and classes used to interface with the widgets generated by Figma2Flutter Figma plugin service.


  • Switch between generated screens
  • Add event listeners to global events such as pageLoaded
  • Add event listeners to widgets generated with Figma2Flutter by using Flutter's event names
  • Get reference to widgets currently displayed on the screen
  • Change states of currently displayed widgets
  • Set and get data from widgets, for example, get value from text input or set image URL to the image element
  • witch between generated screens


Figma2Flutter Element It contains at least Figma name, Figma id and Flutter widget instance Most of the functions such as getElementsByName will contain instances of this class in the responses.
Figma2Flutter Event It contains at least eventName, the name of the event from Flutter, componentName, the name of the Figma instance. and sometimes target element reference and payload string


elementInstances Map<int, Elem>
A map of all currently active elements
read / write
eventSubscriptions Map<String, Map<String, Map<int, List<Event>>>>
A map of component event subscriptions
read / write
images Map<String, Image>
A map of images
read / write
isInitialized bool
read / write
isWeb bool
read / write
screenClasses Map<String, Elem>
A map of screen elements
read / write
simpleEvents Map<String, List<Event>>
A Map of simple events such as page loaded
read / write


addComponentItems(String name, dynamic itemsString, [int index = 0]) → void
Same as setComponentItems but it will append items to the end of the ListView
getApp({dynamic withInit = Function}) App
Returns App instance representing application generated from Figma. When App is initialized, withInit callback is triggered.
getComponentState(String name, [int index = 1]) String
Returns current sate name of the element referenced by Figma name
getComponentText(String name, [int index = 0]) String
Returns text string currently being displayed in the element referenced by it's Figma name
getElementsByName(String name, [int limit = 1]) List<Elem>
Returns List of Figma2Flutter elements (Elem) with same FIgma name. Limit number of returned elements by specifying limit Only currently active elements will be returned (i.e. elements displayed on current page)
getFirstElementByName(String name) Elem
Returns first element matching Figma name
getLocationSearch() String
getWidgetHashCode(String name, [int index = 0]) int
getWidgetInstanceByName(String name, {Map<String, dynamic> properties = const {}}) → dynamic
Returns new Flutter widget instance referenced by it's Figma name with optional Map of properties to initialize the widget with.
openAppPage(String name) → void
Open page (screen, menu, popup) of the generated application using it's FIgma name
parseItem(dynamic item) Map<String, dynamic>
parseItems(dynamic itemsString) List<Map<String, dynamic>>
removeAllComponentEvents() → void
Removes all currently attached componen evens
removeComponentEvent(Event evt) → void
Removes component event [...]
replaceComponentItems(String name, dynamic itemsString, [int index = 0, int offset = 0]) → void
Same as setComponentItems but will set items starting from offset item
setComponentImageUrl(String name, String url, [int index = 0]) → void
Sets network image url to be displayed in the element referenced by it's Figma name Only works on Figma nodes that contain Image fill
setComponentItems(String name, dynamic itemsString, [int index = 0]) → void
Sets ListView items on annotated ListView Figma element referenced by it's name ListView items (itemsString) are represented as array of JSON objects either as List (i.e. returned from jsonDecode()) or as stringified JSON or as List<Map<String, dynamic>> Each item in the array represents an item in the ListView
setComponentProperties(String name, String props, [int index = 0]) → void
Set properties to Figma2Flutter element referenced by it's name
setComponentState(String name, String stateName, [int index = 0, bool asDefault = false]) → void
Sets Figma2Flutter component state by Figma name and stateName
setComponentText(String name, String text, [int index = 0]) → void
Sets text to be displayed in the element referenced by it's Figma name Only works on TEXT Figma nodes
setDropdownValues(String name, List values, [int index = 0]) → void
subscribeToComponentEvent(String eventName, String componentName, dynamic callback(Event), [int index = 0]) Event
Subscribes to events emitted by the components [...]
subscribeToEvent(String eventName, dynamic callback(Event)) int
Subscribes to global Event such as 'pageLoaded', with a callback function
subscribeToEventOnce(String eventName, dynamic callback(Event)) int
triggerComponentEvent(String eventName, int hashCode, String componentName, [String payload = '']) → void
triggerEvent(String eventName, [String payload = '', Map<String, dynamic> data = const {}]) → void
Triggers global Event such as 'pageLoaded', with payload