resolveMatchPath function

String? resolveMatchPath({
  1. required NodeList<Expression> arguments,
})

Resolve a match path

Implementation

String? resolveMatchPath({required NodeList<Expression> arguments}) {
  final pathArgument = arguments.first;
  if (pathArgument is SimpleStringLiteral) {
    return pathArgument.value;
  } else if (pathArgument is SimpleIdentifier) {
    final pathName = pathArgument.name;
    if (pathName == 'firestoreRoot') {
      return '/databases/{database}/documents';
    } else if (pathName == 'storageRoot') {
      return '/b/{bucket}/o';
    }
  }

  // The path is invalid
  return null;
}