importElements method

  1. @experimental
Future<ImportElementsResult> importElements(
  1. String? file,
  2. List<ImportedElements>? elements, {
  3. int? offset,
})

Return a list of edits that would need to be applied in order to ensure that all of the elements in the specified list of imported elements are accessible within the library.

If a request is made for a file that does not exist, or that is not currently subject to analysis (e.g. because it is not associated with any analysis root specified via analysis.setAnalysisRoots), an error of type IMPORT_ELEMENTS_INVALID_FILE will be generated.

Implementation

@experimental
Future<ImportElementsResult> importElements(
    String? file, List<ImportedElements>? elements,
    {int? offset}) {
  final Map m = {'file': file, 'elements': elements};
  if (offset != null) m['offset'] = offset;
  return _call('edit.importElements', m).then(ImportElementsResult.parse);
}