Flutter Generator#

class besser.generators.flutter.flutter_generator.FlutterGenerator(model, gui_model, main_page, module=None, output_dir=None)[source]#

Bases: GeneratorInterface

A class that represents a Flutter code generator.

This class extends the GeneratorInterface, which is an interface or base class for code generators.

Parameters:
  • model – An object representing the B-UML model.

  • gui_model – An object representing the GUI model.

  • main_page – An object representing the main page of the Flutter application.

  • module – An object representing the module of the Flutter application.

  • output_dir – The output directory where the generated code will be saved. (optional)

_abc_impl = <_abc._abc_data object>#
generate()[source]#

Generates the Flutter code based on the provided models.

This method creates instances of the FlutterSQLHelperGenerator, FlutterMainDartGenerator, and FlutterPubspecGenerator classes. It then calls the generate() method on each of them to generate the SQL helper code, main Dart code, and pubspec.yaml file, respectively.

Returns:

None None, but store the generated code as files main.dart, sql_helper.dart, and pubspec.yaml.

class besser.generators.flutter.flutter_generator.FlutterMainDartGenerator(model: DomainModel, gui_model: GUIModel, main_page: Screen, module: Module = None, output_dir: str = None)[source]#

Bases: GeneratorInterface

FlutterMainDartGenerator is a class that implements the GeneratorInterface and is responsible for generating the main Dart code for a Flutter application based on the input B-UML and GUI models.

Parameters:
  • model (DomainModel) – An instance of the DomainModel class representing the B-UML model.

  • gui_model (GUIModel) – An instance of the GUIModel class representing the GUI model.

  • main_page (Screen) – An instance of the Screen class representing the main page of the Flutter application.

  • module (Module) – An instance of the Module class representing the module of the Flutter application.

  • output_dir (str, optional) – The output directory where the generated code will be saved. Defaults to None.

_abc_impl = <_abc._abc_data object>#
generate()[source]#

Generates the main Dart code for a Flutter application based on the provided B-UML and GUI models and saves it to the specified output directory. If the output directory was not specified, the code generated will be stored in the <current directory>/output folder.

Returns:

None, but stores the generated code as a file named main.dart.

property gui_model: GUIModel#

Get the instance of the GUIModel class representing the GUI model.

Type:

GUIModel

static is_Button(value)[source]#

Check if the given value is an instance of Button class.

static is_List(value)[source]#

Check if the given value is an instance of DataList class.

static is_ModelElement(value)[source]#

Check if the given value is an instance of DataSourceElement class.

property main_page: Screen#

Get the instance of the Screen class representing the main page of the Flutter application.

Type:

Screen

property module: Module#

Get the instance of the Module class representing the module of the Flutter application.

Type:

Module

class besser.generators.flutter.flutter_generator.FlutterPubspecGenerator(gui_model: GUIModel, output_dir: str = None)[source]#

Bases: GeneratorInterface

FlutterPubspecGenerator is a class that implements the GeneratorInterface and is responsible for generating the pubspec.yaml file for a Flutter application based on the input GUI model.

Parameters:
  • gui_model (GUIModel) – An instance of the GUIModel class representing the GUI model.

  • output_dir (str, optional) – The output directory where the generated code will be saved. Defaults to None.

_abc_impl = <_abc._abc_data object>#
generate()[source]#

Generates the pubspec.yaml file for a Flutter application based on the provided GUI model and saves it to the specified output directory. If the output directory was not specified, the code generated will be stored in the <current directory>/output folder.

Returns:

None, but stores the generated code as a file named pubspec.yaml.

property gui_model: GUIModel#

Get the instance of the GUIModel class representing the GUI model.

Type:

GUIModel

class besser.generators.flutter.flutter_generator.FlutterSQLHelperGenerator(model: DomainModel, output_dir: str = None)[source]#

Bases: GeneratorInterface

FlutterSQLHelperGenerator is a class that implements the GeneratorInterface and is responsible for generating the Flutter SQL helper code based on the input B-UML model.

Parameters:
  • model (DomainModel) – An instance of the DomainModel class representing the B-UML model.

  • output_dir (str, optional) – The output directory where the generated code will be saved. Defaults to None.

TYPES = {'bool': 'bool', 'date': 'date', 'datetime': 'timestamp', 'float': 'float8', 'int': 'int?', 'str': 'String', 'time': 'time', 'timedelta': 'interval'}#
_abc_impl = <_abc._abc_data object>#
generate()[source]#

Generates Flutter SQL helper code based on the provided B-UML model and saves it to the specified output directory. If the output directory was not specified, the code generated will be stored in the <current directory>/output folder.

Returns:

None, but stores the generated code as a file named sql_helper.dart.