Merge pull request #2 from appwrite/env-support

Env support
This commit is contained in:
Matej Bačo
2025-03-11 14:22:39 +01:00
committed by GitHub
6 changed files with 17 additions and 25 deletions

View File

@@ -3,12 +3,10 @@ class ProjectInfo {
final String endpoint;
final String projectId;
final String projectName;
final String version;
ProjectInfo({
required this.endpoint,
required this.projectId,
required this.projectName,
required this.version,
});
}

View File

@@ -1,17 +1,16 @@
import 'package:intl/intl.dart';
import 'package:appwrite/appwrite.dart';
import 'package:appwrite_flutter_starter_kit/data/models/log.dart';
import 'package:appwrite_flutter_starter_kit/data/models/project_info.dart';
import 'package:intl/intl.dart';
/// A repository responsible for handling network interactions with the Appwrite server.
///
/// It provides a helper method to ping the server.
class AppwriteRepository {
static const String pingPath = "/ping";
static const String appwriteVersion = "1.6.1";
static const String appwriteProjectId = "project-id";
static const String appwriteProjectName = "My project";
static const String appwritePublicEndpoint = "https://cloud.appwrite.io/v1";
static const String appwriteProjectId = String.fromEnvironment('APPWRITE_PROJECT_ID');
static const String appwriteProjectName = String.fromEnvironment('APPWRITE_PROJECT_NAME');
static const String appwritePublicEndpoint = String.fromEnvironment('APPWRITE_PUBLIC_ENDPOINT');
final Client _client = Client()
.setProject(appwriteProjectId)
@@ -35,7 +34,6 @@ class AppwriteRepository {
endpoint: appwritePublicEndpoint,
projectId: appwriteProjectId,
projectName: appwriteProjectName,
version: appwriteVersion,
);
}

View File

@@ -242,15 +242,6 @@ class ProjectSection extends StatelessWidget {
ProjectRow(title: "Project ID", value: projectInfo.projectId),
],
),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
ProjectRow(
title: "Project Name", value: projectInfo.projectName),
ProjectRow(title: "Version", value: projectInfo.version),
],
),
],
),
),