/
static.dart
41 lines (33 loc) · 1.15 KB
/
static.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2016 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
import 'package:meta/meta.dart';
import 'package:charcode/charcode.dart';
import 'package:source_span/source_span.dart';
import '../import.dart';
import '../interpolation.dart';
import '../supports_condition.dart';
/// An import that produces a plain CSS `@import` rule.
///
/// {@category AST}
@sealed
class StaticImport implements Import {
/// The URL for this import.
///
/// This already contains quotes.
final Interpolation url;
/// The supports condition attached to this import, or `null` if no condition
/// is attached.
final SupportsCondition? supports;
/// The media query attached to this import, or `null` if no condition is
/// attached.
final Interpolation? media;
final FileSpan span;
StaticImport(this.url, this.span, {this.supports, this.media});
String toString() {
var buffer = StringBuffer(url);
if (supports != null) buffer.write(" supports($supports)");
if (media != null) buffer.write(" $media");
return buffer.toString();
}
}