पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv2.0.6

fluri

Fluri एक सुविधाजनक URI पुस्तकालय है जो URI परिवर्तन को आसान बनाने के लिए बनाया गया है।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
30.3 हज़ार
लाइक
6
Pub अंक
140

पैकेज इंस्टॉल करें

flutter pub add fluri

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

Fluri एक प्रवाहमय URI पुस्तकालय है जो Dart और Flutter एप्लिकेशन में URI संचालन को सरल बनाने के लिए डिज़ाइन किया गया है। यह आसानी से URI निर्माण, संशोधन और विश्लेषण के लिए एक स्पष्ट, चेनबल API प्रदान करता है। विकासकर्ता शुद्ध, पठनीय कोड के साथ मार्ग, प्रश्न पैरामीटर और खंड जोड़ने में बिना किसी दिक्कत के अनुभव कर सकते हैं। Workiva द्वारा बनाया गया, Fluri Android, iOS, Web, macOS, Windows और Linux सहित सभी प्रमुख प्लेटफॉर्म का समर्थन करता है, जो एक विश्वसनीय URL हैंडलिंग की आवश्यकता वाले क्रॉस-प्लेटफॉर्म प्रोजेक्ट्स के लिए आदर्श है।

उपयोग

  • डायनामिक API एंडपॉइंट्स बनाना
  • रनटाइम पर URL का विश्लेषण और संशोधन
  • जटिल क्वेरी स्ट्रिंग निर्माण
  • सापेक्ष और निरपेक्ष URIs का प्रबंधन
  • विविध URL के साथ HTTP क्लाइंट का परीक्षण करें
  • पैरामीटर के साथ नेविगेशन रूट्स का प्रबंधन करना

मुख्य विशेषताएँ

  • फ्लुएंट, चेनेबल एपीआई
  • प्रश्न पैरामीटर म्यूटेशन का समर्थन
  • आसान मार्ग और खंड संचालन
  • प्लेटफॉर्म के अनुकूलता
  • अपरिवर्तनीय URI निर्माण
  • टिकाऊ पार्सिंग और सीरियलाइजेशन

इनके लिए उपयुक्त

  • लचीले URI संभाल की आवश्यकता वाले Flutter विकासकर्ता
  • गतिशील एंडपॉइंट जनरेशन की आवश्यकता वाले API क्लाइंट्स
  • जटिल रूटिंग या डीप लिंकिंग वाले ऐप्स
  • साफ और बनाए रखने योग्य URL तर्क को प्राथमिकता देने वाली टीमें
  • कई प्लेटफॉर्म के लिए प्रोजेक्ट

विचार योग्य बातें

  • निम्न स्तर के URL विश्लेषण के लिए नहीं बनाया गया है
  • URI संरचना की समझ आवश्यक है
  • सरल स्थिर URL के लिए अतिरिक्त ओवरहेड जोड़ सकता है
  • URI-विशिष्ट कार्यों तक सीमित
  • डिओ या http जैसे HTTP क्लाइंट के साथ उपयोग करने के लिए सबसे अच्छा

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

fluri

Pub Build Status documentation

Examples/Usage

Fluri is a fluent URI library for Dart built to make URI mutation easy.

The dart:core.Uri class provides an immutable representation of URIs, which makes it difficult to incrementally build them or update them at a later time. If you wanted to build a long URI from the individual pieces, you would do something like this:

var uri = Uri(
  scheme: 'https',
  host: 'example.com',
  path: 'path/to/resource'
);

If you later wanted to update the path and add a query parameter, you'd have to do this:

uri = uri.replace(
  path: 'new/path',
  query: 'foo=true'
);

Now let's say you want update the query without losing what you already have:

var query = Map.from(uri.queryParameters);
query['bar'] = '10';
uri = uri.replace(queryParameters: query);

As you can see, incremental or fluent-style URI mutations become a hassle with the core Uri class.

With fluri, the above interactions are easy:

import 'package:fluri/fluri.dart';

var fluri = Fluri()
  ..scheme = 'https'
  ..host = 'example.com'
  ..path = 'path/to/resource';

fluri
  ..path = 'new/path'
  ..query = 'foo=true';

fluri.updateQuery({'bar': '10'});

Additional methods like appendToPath and setQueryParam make it easy to build on top of a base URL:

import 'package:fluri/fluri.dart';

var base = Fluri('https://example.com/base/');

var fluri = Fluri.from(base)
  ..appendToPath('path/to/resource')
  ..setQueryParam('count', '10');

Fluri also supports multi-value parameters. To access the query parameters as Map<String, List<String>>, use queryParametersAll (just like the Uri class):

var fluri = Fluri('/resource?format=json&format=text');
print(fluri.queryParameters); // {'format': 'text'}
print(fluri.queryParametersAll); // {'format': ['json', 'text']}

To set a single query parameter to multiple values:

var fluri = Fluri('/resource');
fluri.setQueryParam('format', ['json', 'text']);
print(fluri.queryParametersAll); // {'format': ['json', 'text']}

Using setQueryParam will always replace existing values:

var fluri = Fluri('/resource');
fluri.setQueryParam('format', ['json', 'text']);
fluri.setQueryParam('format', ['binary', 'text']);
print(fluri.queryParametersAll); // {'format': ['binary', 'text']}

You can use the queryParametersAll setter to set the entire query with multi-value param support:

var fluri = Fluri('/resource');
fluri.queryParametersAll = {'format': ['json', 'text'], 'count': ['5']}
print(fluri.queryParametersAll); // {'format': ['json', 'text'], 'count': ['5']}

Again, if you need to preserve existing query parameters, you can use the updateQuery method to do so. Set mergeValues: true and any values that you provide will be merged with existing values:

var fluri = Fluri('/resource?format=json');
fluri.updateQuery({'format': ['binary', 'text'], 'count': '5'}, mergeValues: true);
print(fluri.queryParametersAll); // {'format': ['binary', 'json', 'text'], 'count': ['5']}

श्रेणियाँ

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट