上一页 1 2 3 4 5 6 ··· 186 下一页
摘要: 一,代码: Future<String> getMyName() { return Future.delayed(Duration(seconds: 2), () => '老孟'); } void myclick() async{ //错误得到Future类型返回 var name = getMyN 阅读全文
posted @ 2026-03-08 12:32 刘宏缔的架构森林 阅读(5) 评论(0) 推荐(0)
摘要: 一,代码: //每1秒打印一下当前数字 void tick10() async { for (int i = 1; i <= 10; i++) { await Future.delayed(Duration(seconds: 1),(){ print("tick"+i.toString()); }) 阅读全文
posted @ 2026-03-08 10:44 刘宏缔的架构森林 阅读(2) 评论(0) 推荐(0)
摘要: 一,代码 void myclick() async{ print("a"); //await tells dart to wait till this completes. // If it's not used before a future, // then dart doesn't wait 阅读全文
posted @ 2026-03-07 22:16 刘宏缔的架构森林 阅读(3) 评论(0) 推荐(0)
摘要: 一,代码: 1,main import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:get/get.dart'; impor 阅读全文
posted @ 2026-03-07 21:13 刘宏缔的架构森林 阅读(7) 评论(0) 推荐(0)
摘要: 一,代码: 1,main import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:get/get.dart'; impor 阅读全文
posted @ 2026-03-07 20:55 刘宏缔的架构森林 阅读(9) 评论(0) 推荐(0)
摘要: 一,代码: model: class ListItemModel { String author; String title; int id; ListItemModel(this.author,this.title, this.id) {} ListItemModel.fromJson(Map<S 阅读全文
posted @ 2026-03-04 18:52 刘宏缔的架构森林 阅读(5) 评论(0) 推荐(0)
摘要: 一,报错信息: Vertical viewport was given unbounded height 二,解决: 原代码: return Scaffold( appBar: AppBar(title: Text('这是首页'),), body: Center( child:Column( chi 阅读全文
posted @ 2026-03-04 17:55 刘宏缔的架构森林 阅读(4) 评论(0) 推荐(0)
摘要: 一,代码: 按纽代码 import 'package:flutter/material.dart'; class MyButton extends StatelessWidget { final GestureTapCallback onPressed; //点击事件的回调,一旦设置后就不可变 My 阅读全文
posted @ 2026-03-03 17:57 刘宏缔的架构森林 阅读(5) 评论(0) 推荐(0)
摘要: 一,代码: controller: import 'package:get/get.dart'; import 'package:dio/dio.dart'; import 'dart:convert'; import 'dart:io'; // 定义控制器 class DetailControll 阅读全文
posted @ 2026-03-03 15:19 刘宏缔的架构森林 阅读(5) 评论(0) 推荐(0)
摘要: 一,安装 地址: https://pub.dev/packages/dio 编辑pubspec.yaml dependencies: dio: ^5.9.2 二,代码 import 'package:flutter/material.dart'; import 'package:dio/dio.da 阅读全文
posted @ 2026-03-03 14:25 刘宏缔的架构森林 阅读(3) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 186 下一页