eval method

dynamic eval(
  1. String content, {
  2. String? filename,
  3. String? module,
  4. bool globallyImport = false,
  5. HTResourceType type = HTResourceType.hetuLiteralCode,
  6. String? invoke,
  7. List positionalArgs = const [],
  8. Map<String, dynamic> namedArgs = const {},
})

Evaluate a string content. If invoke is provided, will immediately call the function after evaluation completed.

Implementation

dynamic eval(
  String content, {
  String? filename,
  String? module,
  bool globallyImport = false,
  HTResourceType type = HTResourceType.hetuLiteralCode,
  String? invoke,
  List<dynamic> positionalArgs = const [],
  Map<String, dynamic> namedArgs = const {},
  // List<HTType> typeArgs = const [],
}) {
  if (content.trim().isEmpty) return null;
  final source = HTSource(content, filename: filename, type: type);
  final result = evalSource(
    source,
    module: module,
    globallyImport: globallyImport,
    invoke: invoke,
    positionalArgs: positionalArgs,
    namedArgs: namedArgs,
    // typeArgs: typeArgs,
  );
  return result;
}