Skip to content

Env support #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
APPWRITE_PROJECT_ID=
APPWRITE_PROJECT_NAME=
APPWRITE_PUBLIC_ENDPOINT=
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ migrate_working_dir/
.pub/
/build/

.env

# Symbolication related
app.*.symbols

Expand Down Expand Up @@ -80,4 +82,4 @@ fastlane/sign&cert
*~
*.save
._*
*.bak
*.bak
2 changes: 0 additions & 2 deletions lib/data/models/project_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
10 changes: 4 additions & 6 deletions lib/data/repository/appwrite_repository.dart
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -35,7 +34,6 @@ class AppwriteRepository {
endpoint: appwritePublicEndpoint,
projectId: appwriteProjectId,
projectName: appwriteProjectName,
version: appwriteVersion,
);
}

Expand Down
9 changes: 0 additions & 9 deletions lib/ui/components/collapsible_bottomsheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
],
),
],
),
),
Expand Down
14 changes: 7 additions & 7 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.4.0"
checked_yaml:
dependency: transitive
description:
Expand Down Expand Up @@ -77,10 +77,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
url: "https://pub.dev"
source: hosted
version: "1.19.0"
version: "1.19.1"
cookie_jar:
dependency: transitive
description:
Expand Down Expand Up @@ -271,10 +271,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
url: "https://pub.dev"
source: hosted
version: "1.15.0"
version: "1.16.0"
package_info_plus:
dependency: transitive
description:
Expand Down Expand Up @@ -625,5 +625,5 @@ packages:
source: hosted
version: "3.1.3"
sdks:
dart: ">=3.6.0 <4.0.0"
dart: ">=3.7.0-0 <4.0.0"
flutter: ">=3.27.0"