json_listview 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 60

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 packages get

Alternatively, your editor might support 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';
  
Version Uploaded Documentation Archive
0.1.0 Sep 13, 2018 Go to the documentation of json_listview 0.1.0 Download json_listview 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
20
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

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.0.8
charcode 1.1.2
collection 1.14.11
http 0.11.3+17 0.12.0
http_parser 3.1.3
meta 1.1.6
path 1.6.2
sky_engine 0.0.99
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test