getNavigation method

Future<NavigationResult> getNavigation(
  1. String? file,
  2. int? offset,
  3. int? length
)

Return the navigation information associated with the given region of the given file. If the navigation information for the given file has not yet been computed, or the most recently computed navigation information for the given file is out of date, then the response for this request will be delayed until it has been computed. If the content of the file changes after this request was received but before a response could be sent, then an error of type CONTENT_MODIFIED will be generated.

If a navigation region overlaps (but extends either before or after) the given region of the file it will be included in the result. This means that it is theoretically possible to get the same navigation region in response to multiple requests. Clients can avoid this by always choosing a region that starts at the beginning of a line and ends at the end of a (possibly different) line in the file.

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

Implementation

Future<NavigationResult> getNavigation(
    String? file, int? offset, int? length) {
  final Map m = {'file': file, 'offset': offset, 'length': length};
  return _call('analysis.getNavigation', m).then(NavigationResult.parse);
}