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
commit 1ae5710a63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 17 additions and 25 deletions

3
.env.example Normal file
View File

@ -0,0 +1,3 @@
APPWRITE_PROJECT_ID=
APPWRITE_PROJECT_NAME=
APPWRITE_PUBLIC_ENDPOINT=

4
.gitignore vendored
View File

@ -33,6 +33,8 @@ migrate_working_dir/
.pub/ .pub/
/build/ /build/
.env
# Symbolication related # Symbolication related
app.*.symbols app.*.symbols
@ -80,4 +82,4 @@ fastlane/sign&cert
*~ *~
*.save *.save
._* ._*
*.bak *.bak

View File

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

View File

@ -242,15 +242,6 @@ class ProjectSection extends StatelessWidget {
ProjectRow(title: "Project ID", value: projectInfo.projectId), 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),
],
),
], ],
), ),
), ),

View File

@ -45,10 +45,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.0" version: "1.4.0"
checked_yaml: checked_yaml:
dependency: transitive dependency: transitive
description: description:
@ -77,10 +77,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.19.0" version: "1.19.1"
cookie_jar: cookie_jar:
dependency: transitive dependency: transitive
description: description:
@ -271,10 +271,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.15.0" version: "1.16.0"
package_info_plus: package_info_plus:
dependency: transitive dependency: transitive
description: description:
@ -625,5 +625,5 @@ packages:
source: hosted source: hosted
version: "3.1.3" version: "3.1.3"
sdks: sdks:
dart: ">=3.6.0 <4.0.0" dart: ">=3.7.0-0 <4.0.0"
flutter: ">=3.27.0" flutter: ">=3.27.0"