canonicalGlobalInstruction method

Future<(String, bool)> canonicalGlobalInstruction(
  1. ReadonlyContext context
)

Resolves global instruction text and whether it was dynamic.

Implementation

Future<(String, bool)> canonicalGlobalInstruction(
  ReadonlyContext context,
) async {
  final Object value = globalInstruction;
  if (value is String) {
    return (value, false);
  }
  if (value is InstructionProvider) {
    return (await Future<String>.value(value(context)), true);
  }
  throw ArgumentError(
    'globalInstruction must be String or InstructionProvider.',
  );
}