需要生成一个随机数作为api参数
实现:
import 'dart:math';/// dart 生成固定随机数void main(){ String alphabet = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'; int strlenght = 30; /// 生成的字符串固定长度 String left = ''; for (var i = 0; i < strlenght; i++) { // right = right + (min + (Random().nextInt(max - min))).toString(); left = left + alphabet[Random().nextInt(alphabet.length)]; } print(left); }
效果: