The first step is to include the generator for the language in question. Blockly includes the following generators:
The generator class should be included right after
The user's blocks may be exported to code at any time from your application with this call:
Dart in both preceding lines to
switch the language generated.
Generating code is an extremely fast operation, so there's no harm in calling this function frequently. A common strategy is to generate and display code in realtime by adding a listener to Blockly's change event:
See Events for more information.