Line data Source code
1 : import 'dart:math'; 2 : 3 : /// {@template tab_indentation} 4 : /// writes new line with tab indentation 5 : /// {@endtemplate} 6 2 : String tab(String s, [int n = 1]) { 7 2 : n = max(n, 0); 8 : 9 4 : return '${tabIndentation * n}$s'; 10 : } 11 : 12 : /// The tab indentation string. 13 : const tabIndentation = ' '; 14 : 15 : /// prepares values to be written to the output file 16 1 : String prepareValueForGen<T>(T value) { 17 1 : if (value is String) { 18 1 : return "'$value'"; 19 : } 20 1 : return '$value'; 21 : } 22 : 23 : /// checks if the given [type] is nullable 24 2 : bool isTypeAsStringNullable(String type) { 25 2 : return type.endsWith('?'); 26 : }