THATMobile/update_open_api.ps1

14 lines
745 B
PowerShell

# Đảm bảo dùng Dart của Flutter (tránh lỗi frontend_server.dart.snapshot trên Dart 3.5+)
$flutterRoot = if ($env:FLUTTER_ROOT) { $env:FLUTTER_ROOT } else { (Get-Command flutter -ErrorAction SilentlyContinue).Source | ForEach-Object { Split-Path (Split-Path $_) } }
if ($flutterRoot) {
$env:Path = "$flutterRoot\bin\cache\dart-sdk\bin;$flutterRoot\bin;$env:Path"
}
# Tải các file JSON về thư mục tương ứng
Invoke-WebRequest -Uri "https://api.hra.edu.vn/swagger/v1/swagger.json" -OutFile "./lib/features/repositories/hra_repository.json"
# Chạy build_runner
dart run build_runner build --delete-conflicting-outputs
# Xóa các file JSON đã tải về
Remove-Item "./lib/features/repositories/hra_repository.json"