सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
dart_gsheet_remote_config के लिए फ्लटर और डार्ट ऐप्स को वास्तविक समय में गूगल शीट्स से कॉन्फ़िगरेशन मान प्राप्त करने की अनुमति देता है, जिससे नए रिलीज़ के बिना ऐप व्यवहार को डायनामिक अपडेट किया जा सकता है। गूगल शीट को दूरस्थ कॉन्फ़िगरेशन स्रोत के रूप में उपयोग करके, डेवलपर्स फीचर, फ्लैग या सेटिंग्स को तुरंत एडजस्ट कर सकते हैं। यह पैकेज एंड्रॉइड, आईओएस, वेब, मैकओएस, विंडोज और लिनक्स जैसे विभिन्न प्लेटफॉर्म को सपोर्ट करता है, जिससे लचीले और स्केलेबल ऐप प्रबंधन के लिए उपयुक्त होता है।
उपयोग
डायनामिक फीचर टॉगलिंग
रियल-टाइम UI थीम बदलाव
परिवेश-विशिष्ट विन्यास
ए/बी टेस्ट कॉन्फ़िगरेशन
दूरस्थ डिबगिंग और मॉनिटरिंग
डिप्लॉयमेंट के बिना तत्काल ऐप अपडेट
मुख्य विशेषताएँ
Google Sheets को कॉन्फ़िगरेशन स्रोत के रूप में उपयोग करें
वास्तविक समय कॉन्फ़िगरेशन अपडेट
बहु-प्लेटफॉर्म समर्थन
Flutter/Dart के साथ सरल एकीकरण
Google Sheets API के माध्यम से सुरक्षित पहुंच
स्वचालित कैश प्रबंधन
इनके लिए उपयुक्त
अक्सर कॉन्फ़िगरेशन बदलाव की आवश्यकता वाले ऐप्स
बहुत से वातावरणों का प्रबंधन कर रही टीमें
A/B टेस्टिंग का उपयोग करने वाले प्रोजेक्ट
छोटे बदलाव के लिए ऐप स्टोर प्रस्तुतियों से बचने वाले विकासकर्मी
त्वरित अनुकूलन की आवश्यकता वाले उत्पाद
विचार योग्य बातें
Google Cloud प्रोजेक्ट सेटअप की आवश्यकता है
उचित प्रमाणीकरण की आवश्यकता है (OAuth 2.0)
इंटरनेट कनेक्टिविटी पर निर्भर है
प्रारंभिक लोड के लिए संभावित लेटेंसी
Google Sheets API पर दर सीमाएं
संवेदनशील डेटा को एन्क्रिप्ट किया जाना चाहिए
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
Dart Google Sheet Remote Config
This is a package that allows you to use Google Sheets as a remote config for changing your Dart/Flutter app's behaviors, settings,.. without updating. It is inspired by @theapache64's blog.
If you have some configs (API key, token,...) related to security, please DO NOT use this package, because it is PUBLIC and NOT SECURE.
Setup
Google Sheet
Create a Google Sheet document, make it PUBLIC & READ ONLY (If not you will get 401, in the future I will find the way to inject auth token for private sheeet) and put an easy to remember document name.
Add your data to sheet in format:
First column will be keys
Second column will be values
MUST READ: Every values in sheet is marked as String. For int, doube, bool, we should convert it to String, use TO_TEXT fomular to convert value to String type:
You can create more than 1 worksheet to manage your config better and it can be selected to get correct data.
Dart
dart pub add dart_gsheet_remote_config
Flutter
flutter pub add dart_gsheet_remote_config
How to use
Create your SheetRemoteConfig instance.
import'package:dart_gsheet_remote_config/dart_gsheet_remote_config.dart';
final remoteConfig = SheetRemoteConfig();
SheetRemoteConfig has a param Client from http package so you can pass your custom Client object when create SheetRemoteConfig instance.
import'package:dart_gsheet_remote_config/dart_gsheet_remote_config.dart';
import'package:http/http.dart'as http;
final client = http.Client();
final remoteConfig = SheetRemoteConfig(client: client);
Fetch remote config data
SheetRemoteConfig provides initilize function and you must pass id and sheetName to initilize remote config:
Document id you can find it in your Google Sheet document Url. For example your Sheet url is https://docs.google.com/spreadsheets/d/123456789, id will be 123456789.
sheetName is worksheet name, nullable, first worksheet will be used if null or passed value is not found.
import'package:dart_gsheet_remote_config/dart_gsheet_remote_config.dart';
final remoteConfig = SheetRemoteConfig();
await remoteConfig.initilize(id: '123456789'); // First worksheet will be usedawait remoteConfig.initilize(id: '123456789', sheetName: 'Sheet1'); // Use specific worksheet name
MUST READ: id mustn't be hardcode if you don't want others to use your remote config. You can use id as .env field or via dart-define and pass it to your app via environment variable. You can use some packages like flutter_dotenv, envied to load .env file.
Get data from remote
SheetRemoteConfig fetchs data in CSV format, data is returned in key-value format, you can key to get value via
get functions, currently SheetRemoteConfig supports String, int, double, bool.
Example response:
"key1","TRUE"
"key2","10"
"key3","value from key 3"
"key4,"1.0"
And get data:
final valueKey1 = remoteConfig.getBool('key1');
print(valueKey1); // truefinal valueKey2 = remoteConfig.getInt('key2');
print(valueKey2); // 10final valueKey3 = remoteConfig.getString('key3');
print(valueKey3); // value from key 3final valueKey4 = remoteConfig.getDouble('key4');
print(valueKey4); // 1.0
If provided key is not found or provided T is incorrect, get functions will return null.
final valueKey5 = remoteConfig.getString('key5');
print(valueKey5); // null
You can pass defaultValue when get functions returns null.
final valueKey5 = remoteConfig.getString('key5', defaultValue: 'this is default value');
print(valueKey5); // this is default value
Get all data from remote
SheetRemoteConfig provides getAll function to get all data from remote.
final allData = remoteConfig.getAll();
print(allData); // {key1: true, key2: 10, key3: value from key 3, key4: 1.0}
Happy coding
That's all for now! Want a feature? Found a bug? Create an issue!