json_listview 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

Json ListView #

Json binder for listview, creating a listview with data coming from a rest webservice using few lines of code.

this package will give you a FutureBuilder which contains a loading indicator until your json is loaded from the web then it would provide you the json and gets a Widget from you for the row that belongs tho that json

On Dart Packages : https://pub.dartlang.org/packages/json_listview

Use this package as a library #

1. Depend on it #

Add this to your package's pubspec.yaml file:

dependencies:
  json_listview: ^0.1.0

2. Install it #

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it #

Now in your Dart code, you can use:

import 'package:json_listview/json_listview.dart';

Getting Started #

the package has four types of DataBiding to listview

  • getting a json array list with a GET request and binding it directly to ListView
var list = JsonListView.getArray(
        'https://jsonplaceholder.typicode.com/todos/',
        headers: {},  ///// request headers
        parameters: {},
        padding: 8.0,
        height: 50.0,
        listItem: (json, index) {
          return Text(json["title"]);
        }, onTap: (index) {
          print("$index selected");
        });
  • getting a json object with a GET request and bind a json array inside it to ListView
var list = JsonListView.getArray(
        'https://jsonplaceholder.typicode.com/todos/',
        headers: {},  ///// request headers
        parameters: {},
        padding: 8.0,
        height: 50.0,
        arrayBinding: (JsonObject parentJson) => parentJson["list"],
        listItem: (json, index) {
          return Text(json["title"]);
        }, onTap: (index) {
          print("$index selected");
        });
  • getting a json array list with a POST request and binding it directly to ListView
var list = JsonListView.getArray(
        'https://jsonplaceholder.typicode.com/todos/',
        headers: {},  ///// request headers
        parameters: {},
        padding: 8.0,
        height: 50.0,
        coding: PostCoding.JSON,
        listItem: (json, index) {
          return Text(json["title"]);
        }, onTap: (index) {
          print("$index selected");
        });
  • getting a json object with a POST request and bind a json array inside it to ListView
var list = JsonListView.getArray(
        'https://jsonplaceholder.typicode.com/todos/',
        headers: {},  ///// request headers
        parameters: {},
        padding: 8.0,
        height: 50.0,
        coding: PostCoding.JSON,
        arrayBinding: (JsonObject parentJson) => parentJson["list"],
        listItem: (json, index) {
          return Text(json["title"]);
        }, onTap: (index) {
          print("$index selected");
        });

[0.1.0] - TODO: Add release date.

  • added the package base with example

example/example.dart

import 'package:flutter/material.dart';
import 'package:json_listview/json_listview.dart';

void main() {
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new MainScreen(),
    );
  }
}

class MainScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var list = JsonListView.getArray(
        'https://jsonplaceholder.typicode.com/todos/',
        headers: {},  ///// request headers
        parameters: {},
        padding: 8.0,
        height: 50.0,
        listItem: (json, index) {
          return Text(json["title"]);
        }, onTap: (index) {
          print("$index selected");
        });
    return Scaffold(body: list);
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  json_listview: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:json_listview/json_listview.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
60
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
56
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

We analyzed this package on Dec 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Health issues and suggestions

Document public APIs. (-1 points)

7 out of 7 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/json_listview.dart.

Run flutter format to format lib/json_listview.dart.

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/ymazdy/json_listview was unreachable.

Package is getting outdated. (-23.56 points)

The package was last published 64 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
networkjson ^0.1.5 0.1.5
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
http 0.11.3+17 0.12.0+2
http_parser 3.1.3
meta 1.1.7 1.1.8
path 1.6.4
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test