index property
int
index
The index within a list of sorted directives.
import 'dart:core'; // 0
import 'package:test/test.dart'; // 1
Implementation
int get index {
if (kind == DirectiveKind.import) {
// There are three different types of imports.
if (RegExp(r'^dart:.*$').hasMatch(url)) {
return -3;
}
if (RegExp(r'^package:.*\.dart$').hasMatch(url)) {
return -2;
}
if (RegExp(r'^\.+\/.*\.dart$').hasMatch(url)) {
return -1;
}
}
return kind.index;
}