dart annotation
摘要:dart/flutter annotation 注解或者元编程 dart 或者是 Java注解 或者是 Python 元编程 注解或者元编程都是装饰器模式的视线 dart 通过注解,生成相应的代码,最后编译 Flutter 相关命令 flutter pub run build_runner buil
阅读全文
Dart core library
摘要:Dart core library Dart IO class File & class Directory(两个均是继承自 abstract FileSystemEntity) FIle 仅仅用来操作真正的文件 Directory 仅仅针对文件夹(即使按照规定Directory也是特殊文件) Fi
阅读全文
Dart on keyword
摘要:on 在 mixin 中的使用 abstract class Animal { // properties String name; double speed; // constructor Animal(this.name, this.speed); // abstract method void
阅读全文
Dart final const
摘要:Dart中的const和final 在Dart编程语言中,const和final关键字都用于声明常量。虽然它们的目的相同,但在语义和使用上略有不同。 const const关键字用于创建不可变(immutable)的常量,这些常量的值必须在编译时就已知。const可以用于变量、方法和集合(如List
阅读全文
Dart try on catch
摘要:Dart try catch on finally void main() { int a = 12; int b = 0; int res; try { res = a ~/ b; } on UnsupportedError { // it is used as we know waht erro
阅读全文
dart late / ?
摘要:dart null safety late ?. ?? late String XXX;/// 表示的是这个XXX之后能是必须要进行赋值的,不能为空,那么如果没有进行赋值任何操作(包括 ?.访问或者XXX == null)都是异常的 String? YYY;/// 表示的是YYY可以为空,之后可以进
阅读全文
dart win32 字符串指针
摘要:获取窗口标题 final p = malloc<Pointer<Utf16>>(50); // 在C语言中其实只需要传入一个字符串的指针就可以了,这里的话,是指针的指针 GetWindowText(0x000908A6, p.value, 50); print(p.value.toDartStrin
阅读全文
dart 正则表达式匹配链接
摘要:RegExp RegExp linkRegExp = RegExp(r'(https?|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]');
阅读全文
dart遍历的时候操作list
摘要:实际上,在遍历的时候,list对应的内存是被锁住的 List list = [1, 2, 3, 4]; // 这里使用了箭头函数,后面的表达式为true时会删除当前值 list.removeWhere((value) => value == 2); // 当然也能用{} list.removeWhe
阅读全文
dart 服务器返回video
摘要:HttpServer httpServer = await HttpServer.bind("localhost", 45678); File file = File("C:/Users/19519/Desktop/videos/bg2.mp4"); await for(HttpRequest ht
阅读全文
dart win32
摘要:sizeOf<TYPE>(COUNT) malloc<POINT>()
阅读全文
dart 判定网络连接情况
摘要:import 'dart:io'; void main() async{ try { final result = await InternetAddress.lookup('example.com'); if (result.isNotEmpty && result[0].rawAddress.i
阅读全文
dart Future & Isolate
摘要:Future通过CPU调度实现的,单线程切换 Isolate可能会调用其他CPU内核,Isolate是一个绝对封闭的,通信仅仅能通过SendPort
阅读全文
dart functionSet
摘要:文件 根据传入的路径,返回上N级目录 /// 0表示当前路径, -1 上一级路径 返回值的最后面没有 / /// 最多到达磁盘目录 String getPathFromIndex(String path, int index){ List<String> dirNames = path.split(
阅读全文
dart文件中的属性以及(class)类属性
摘要:dart不像java只能在class里面定义属性,而属性为类属性或者对象属性 dart在此之外还可以直接在dart文件里面定义属性 如 test.dart里面的代码 int a = 1; test.dart里面仅仅有这一行代码,但是这个a可以供其他的任何一个方法/函数调用,并且a的内存始终是不变的
阅读全文
dart file and directory(目录或者文件操作)
摘要:dart 文件目录操作 1. 文件读写 File file = File("XXX"); file.exists();//在假设为文件的时候判定文件是否存在,如果是目录返回false // dart 文件读写,有些需要自己关闭,有些自动关闭,如果不是自己关闭的,那个如果冲突了,就不能写入,因此最好使
阅读全文
win32 EnumWindows in dart
摘要:使用和C里面完全一样 late final int _workerWHexHandle; int _enumWindowsProc(int hWnd,int lParam){ /// print(hWnd.toRadixString(16)); int pHWnd = FindWindowEx(hW
阅读全文
dart use DLL file
摘要:We need to do two steps define two types one for dart itself and one for ffi, with ffi as the bridge typedef ChangeBackgroundFFI = ffi.Void Function(f
阅读全文
dart isolate
摘要:isolate的理解 isolate原型 external static Future<Isolate> spawn<T>( void entryPoint(T message), T message, {bool paused = false, bool errorsAreFatal = true
阅读全文
dart HttpSocket&HttpClient
摘要:HttpSocket var server = await HttpServer.bind( InternetAddress.loopbackIPv4, 4040, ); print('Listening on localhost:${server.port}'); /// 整个isoalate会阻
阅读全文