json_class
peiffer-innovations/json_class open-source repository details.
GitHub पर देखें ↗आर्काइव
- स्टार
- 2
- फ़ोर्क
- 5
- अंतिम पुश (UTC)
- 16 फ़र॰ 2026
- प्रोजेक्ट स्थिति
- आर्काइव
मूल README
यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
Table of Contents
json_class
Singular class that when extended can encode itself to a JSON compatible map or list. This also provides convenience functions to decode from a JSON compatible map or list to the actual data model.
Using the library
Add the repo to your Flutter pubspec.yaml file.
dependencies:
json_class: <<version>>
Then run...
flutter packages get
Example
import 'package:json_class/json_class.dart';
import 'package:meta/meta.dart';
@immutable
class Person extends JsonClass {
Person({
this.age,
this.minor,
this.firstName,
this.lastName,
});
final int age;
final bool minor;
final String firstName;
final String lastName;
static Person fromDynamic(dynamic map) {
// It's recommended to use dynamic over Map<String, dynamic> because it's
// compatible with other types of map-like results such as Firebase Realtime
// Database's values or the ones returned from sqlflite.
Person result;
if (map != null) {
result = Person(
age: JsonClass.parseInt(map['age']),
minor: JsonClass.parseBool(map['minor']),
firstName: map['firstName'],
lastName: map['lastName'],
);
}
return result;
}
static List<Person> fromDynamicList(Iterable<dynamic> list) {
List<Person> results;
if (list != null) {
results = [];
for (dynamic map in list) {
results.add(fromDynamic(map));
}
}
return results;
}
@override
Map<String, dynamic> toJson() => JsonClass.removeNull({
age: age,
minor: minor,
firstName: firstName,
lastName: lastName,
});
}
भाषाएँDart
उपयोग की गई निर्भरताएँ
निर्भरता सूची 5 आइटम
- intl
>=0.18.0<1.0.0 - logging
^1.2.0 - meta
^1.12.0 - flutter_lintsडेवलपमेंट
^5.0.0 - testडेवलपमेंट
^1.25.8
अपने प्रोजेक्ट के लिए रिपॉज़िटरी कैसे चुनें?
उपयोग के अनुसार छाँटें, गतिविधि की तुलना करें और अपनाने से पहले मूल प्रोजेक्ट की आवश्यकताएँ जाँचें।
- नाम, लेखक या विवरण से खोजें और तकनीकी विषय से परिणाम सीमित करें।
- स्टार, फ़ोर्क और हाल के पुश की तुलना करें। स्टार रुचि दर्शाते हैं, गुणवत्ता की गारंटी नहीं।
- उपयोग से पहले GitHub पर README, लाइसेंस और Issues जाँचें।
स्रोत और रखरखाव
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗