import 'package:device_info_plus/device_info_plus.dart'; import 'package:drift/drift.dart'; import 'package:lszlgl/drfit/database.dart'; import 'package:lszlgl/service/print_service.dart'; import '../model/rsp/user_rsp.dart'; import '../service/user_service.dart'; class ModelFactory { static Future convertToTSlideComp(String bleMac, String bleName, String phoneAddress) async { UserRsp? userRsp = UserService.get().getUser(); AndroidDeviceInfo? androidDeviceInfo = await PrintService.getDeviceInfo(); var tsc = DeviceInfoTableCompanion( username: Value.absentIfNull(userRsp?.username), phoneBrand: Value.absentIfNull(androidDeviceInfo?.board), phoneModel: Value.absentIfNull(androidDeviceInfo?.model), phoneRelease: Value.absentIfNull(androidDeviceInfo?.version.release), phoneAddress: Value(phoneAddress), bleMac: Value(bleMac), bleName: Value(bleName), createdAt: Value(DateTime.now().millisecondsSinceEpoch) ); return tsc; } }