Skip to content

Commit e32da99

Browse files
committed
wip: not complete but still starting.
1 parent ae3e6ea commit e32da99

File tree

6 files changed

+35
-12
lines changed

6 files changed

+35
-12
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
APPWRITE_VERSION=
2+
APPWRITE_PROJECT_ID=
3+
APPWRITE_PROJECT_NAME=
4+
APPWRITE_PUBLIC_ENDPOINT=

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ migrate_working_dir/
3333
.pub/
3434
/build/
3535

36+
.env
37+
3638
# Symbolication related
3739
app.*.symbols
3840

lib/data/repository/appwrite_repository.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1+
import 'package:intl/intl.dart';
12
import 'package:appwrite/appwrite.dart';
3+
import 'package:flutter_dotenv/flutter_dotenv.dart';
24
import 'package:appwrite_flutter_starter_kit/data/models/log.dart';
35
import 'package:appwrite_flutter_starter_kit/data/models/project_info.dart';
4-
import 'package:intl/intl.dart';
56

67
/// A repository responsible for handling network interactions with the Appwrite server.
78
///
89
/// It provides a helper method to ping the server.
910
class AppwriteRepository {
1011
static const String pingPath = "/ping";
11-
static const String appwriteVersion = "1.6.1";
12-
static const String appwriteProjectId = "project-id";
13-
static const String appwriteProjectName = "My project";
14-
static const String appwritePublicEndpoint = "https://cloud.appwrite.io/v1";
12+
static final String appwriteVersion = dotenv.env['APPWRITE_VERSION']!;
13+
static final String appwriteProjectId = dotenv.env['APPWRITE_PROJECT_ID']!;
14+
static final String appwriteProjectName = dotenv.env['APPWRITE_PROJECT_NAME']!;
15+
static final String appwritePublicEndpoint = dotenv.env['APPWRITE_PUBLIC_ENDPOINT']!;
1516

1617
final Client _client = Client()
1718
.setProject(appwriteProjectId)

lib/utils/app_initializer.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'dart:io';
33
import 'package:flutter/cupertino.dart';
44
import 'package:flutter/foundation.dart';
55
import 'package:flutter/services.dart';
6+
import 'package:flutter_dotenv/flutter_dotenv.dart';
67
import 'package:window_manager/window_manager.dart';
78

89
/// A utility class for initializing the Flutter application.
@@ -17,6 +18,7 @@ class AppInitializer {
1718
/// and configures device orientation settings.
1819
static initialize() async {
1920
_ensureInitialized();
21+
await _loadDotEnvVariables();
2022
await _setupWindowDimensions();
2123
await _setupDeviceOrientation();
2224
}
@@ -26,6 +28,11 @@ class AppInitializer {
2628
WidgetsFlutterBinding.ensureInitialized();
2729
}
2830

31+
/// Ensures that Flutter bindings are initialized.
32+
static _loadDotEnvVariables() async {
33+
await dotenv.load(fileName: ".env");
34+
}
35+
2936
/// Configures the window dimensions for desktop applications.
3037
///
3138
/// Ensures the window manager is initialized and sets a minimum window size.

pubspec.lock

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ packages:
4545
dependency: transitive
4646
description:
4747
name: characters
48-
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
48+
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
4949
url: "https://pub.dev"
5050
source: hosted
51-
version: "1.3.0"
51+
version: "1.4.0"
5252
checked_yaml:
5353
dependency: transitive
5454
description:
@@ -77,10 +77,10 @@ packages:
7777
dependency: transitive
7878
description:
7979
name: collection
80-
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
80+
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
8181
url: "https://pub.dev"
8282
source: hosted
83-
version: "1.19.0"
83+
version: "1.19.1"
8484
cookie_jar:
8585
dependency: transitive
8686
description:
@@ -158,6 +158,14 @@ packages:
158158
description: flutter
159159
source: sdk
160160
version: "0.0.0"
161+
flutter_dotenv:
162+
dependency: "direct main"
163+
description:
164+
name: flutter_dotenv
165+
sha256: b7c7be5cd9f6ef7a78429cabd2774d3c4af50e79cb2b7593e3d5d763ef95c61b
166+
url: "https://pub.dev"
167+
source: hosted
168+
version: "5.2.1"
161169
flutter_launcher_icons:
162170
dependency: "direct dev"
163171
description:
@@ -271,10 +279,10 @@ packages:
271279
dependency: transitive
272280
description:
273281
name: meta
274-
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
282+
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
275283
url: "https://pub.dev"
276284
source: hosted
277-
version: "1.15.0"
285+
version: "1.16.0"
278286
package_info_plus:
279287
dependency: transitive
280288
description:
@@ -625,5 +633,5 @@ packages:
625633
source: hosted
626634
version: "3.1.3"
627635
sdks:
628-
dart: ">=3.6.0 <4.0.0"
636+
dart: ">=3.7.0-0 <4.0.0"
629637
flutter: ">=3.27.0"

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dependencies:
1414
intl: ^0.20.2
1515
appwrite: ^14.0.0
1616
url_launcher: ^6.3.1
17+
flutter_dotenv: ^5.2.1
1718
window_manager: ^0.4.3
1819
cupertino_icons: ^1.0.8
1920

0 commit comments

Comments
 (0)