dart 库

导入库

导入内置库

import 'dart:html';

 

 

拆分成多个库

 

a.dart

part of "./sum.dart";

class A {
  static int a = 10;
}

b.dart

part of "./sum.dart";

class B {
  static int b = 100;
}

sum.dart

//定义一个库
library sum;

//声明两个文件属于sum库
part './a.dart';
part './b.dart';

int s() {
  return A.a + B.b;
}

main.dart

import './lib/sum.dart';

main(List<String> args) {
  print(s());
}

 

posted @ 2020-09-21 16:25  富坚老贼  阅读(134)  评论(0编辑  收藏  举报