From 3fb74a1710fb091d43486f1e0f60023d9b73dfea Mon Sep 17 00:00:00 2001 From: Kurt Lourens Date: Wed, 24 Jul 2024 19:48:38 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Add=20script=20for=20windows=20b?= =?UTF-8?q?uild?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/create_env_file.dart | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/create_env_file.dart diff --git a/scripts/create_env_file.dart b/scripts/create_env_file.dart new file mode 100644 index 00000000..cad049da --- /dev/null +++ b/scripts/create_env_file.dart @@ -0,0 +1,19 @@ +// ignore_for_file: avoid_print + +import 'dart:convert'; +import 'dart:io'; + +Future main() async { + Map env = Platform.environment; + + final file = File('./lib/env.dart'); + String? contentsInBase64 = env['ENV_DART']; + if (contentsInBase64 == null) { + print('Environment variable is empty'); + return; + } + Codec stringToBase64 = utf8.fuse(base64); + String contents = stringToBase64.decode(contentsInBase64); + await file.writeAsString(contents); + print('Done'); +}