Line data Source code
1 : import 'package:meta/meta.dart'; 2 : import 'package:widgetbook_generator/code_generators/instances/base_instance.dart'; 3 : 4 : @immutable 5 : 6 : /// Calls a function. 7 : /// 8 : /// Example: 9 : /// for a lambda function defined as `() => getTheme()` 10 : /// would call it as `getTheme()` 11 : class FunctionCallInstance extends BaseInstance { 12 : /// Create a new instace of [FunctionCallInstance] 13 2 : const FunctionCallInstance({ 14 : required this.name, 15 : }); 16 : 17 : /// The name of the function 18 : final String name; 19 : 20 0 : @override 21 : String toCode() { 22 0 : return '$name()'; 23 : } 24 : }