pub fn import<P, N>(path: P, name: N) -> Import
Expand description
The import of a Dart type import "dart:math";
.
ยงExamples
use genco::prelude::*;
let a = dart::import("package:http/http.dart", "A");
let b = dart::import("package:http/http.dart", "B");
let c = dart::import("package:http/http.dart", "C").with_alias("h2");
let d = dart::import("../http.dart", "D");
let toks = quote! {
$a
$b
$c
$d
};
let expected = vec![
"import \"../http.dart\";",
"import \"package:http/http.dart\";",
"import \"package:http/http.dart\" as h2;",
"",
"A",
"B",
"h2.C",
"D",
];
assert_eq!(expected, toks.to_file_vec()?);