Skip to content

Nadilson-IFPE/nad_gemini_ai_chat

Repository files navigation

Google Gemini AI Chat App

Flutter application for interacting with Google's Gemini AI.

Environment variables setup / Configuração das variáveis de ambiente

English

NOTE: This application uses the following package to handle environment variables: https://pub.dev/packages/envied. Follow the step-by-step instructions to install and configure it.

VERY IMPORTANT: in Flutter, in a production environment or release version of the app, never use ".env" files to store sensitive data. Depending on your settings, the compiler may insert the environment variables file into the apk file. So, anyone with minimal knowledge of reverse engineering will be able to see this confidential data in the ".env" file inserted in the apk. A great alternative to storing sensitive application data would be on remote services such as Google Firebase or any other that allows you to store this secret information. You can use ".env" files for local testing, but avoid uploading the file to GitHub by adding the following configuration to the ".gitignore" file:

# env
.env
.env.local
env.g.dart

Note: the "env.g.dart" file is generated by the "Envied" package with the "dart run build_runner build -d" command, executed via terminal in the project root, and it contains its properly encrypted environment variables (only if you added the "obfuscate: true" parameter in the "env.dart" file). Therefore, you should not upload this file to Github or other equivalent source code hosting platforms. If you do not wish to use additional third-party packages in your tests, you can also load your environment variables at runtime with the following command: "flutter run --dart-define-from-file=.env".

About security

When you publish your own version of this application, don't forget to generate an apk file with the source code properly obfuscated using the following command:

Android:

flutter build apk --obfuscate --split-debug-info=./debug_info

iOS:

flutter build ios --obfuscate --split-debug-info=./debug_info

------------------------------------------

Portuguese

NOTA: este aplicativo utiliza o seguinte pacote para lidar com variáveis de ambiente: https://pub.dev/packages/envied. Siga o passo-a-passo para instalá-lo e configurá-lo.

MUITÍSSIMO IMPORTANTE: no Flutter, em ambiente de produção ou versão de release do app, jamais utilize arquivos ".env" para guardar dados sensíveis. Dependendo das suas configurações, o compilador pode inserir o arquivo de variáveis de ambiente no arquivo apk. Então, qualquer pessoa com conhecimento mínimio em engenharia reversa poderá ver esses dados sigilosos no arquivo ".env" inserido no apk. Uma grande alternativa para guardar dados sensíveis do aplicativo seria em serviços remotos como o Google Firebase ou qualquer outro que permita guardar essas informações secretas. Você poderá usar arquivos ".env" para testes locais, mas evite fazer upload do arquivo para o GitHub acrescentando no arquivo ".gitignore" a seguinte configuração:

# env
.env
.env.local
env.g.dart

Obs.: o arquivo "env.g.dart" é gerado pelo pacote "Envied" com o comando "dart run build_runner build -d", executado via terminal na raiz do projeto, e ele contém suas variáveis de ambiente devidamente criptografadas (apenas se você adicionou o parâmetro "obfuscate: true" no arquivo "env.dart"). Por isso, você não deve fazer upload deste arquivo para o Github ou outras plataformas de hospedagem de código-fonte equivalentes. Caso não deseje usar pacotes adicionais de terceiros nos seus testes, você também pode carregar suas variáveis de ambiente em tempo de execução com o seguinte comando: "flutter run --dart-define-from-file=.env".

Sobre segurança

Quando você for publicar a sua própria versão deste aplicativo, não esqueça de gerar um arquivo apk com o código-fonte devidamente ofuscado utilizando o comando a seguir:

Android:

flutter build apk --obfuscate --split-debug-info=./debug_info

iOS:

flutter build ios --obfuscate --split-debug-info=./debug_info

------------------------------------------

Screenshot

Google Gemini AI Chat App by Nadilson