Given a JSON string, this library will generate all the necessary Dart classes to parse and generate JSON.

Overview

JSON to Dart

Build Status

Given a JSON string, this library will generate all the necessary Dart classes to parse and generate JSON.

This library is designed to generate Flutter friendly model classes following the flutter's doc recommendation.

Caveats

  • When an empty array is given, it will create a List. Such weird behaviour should warn the user that there is no data to extract.
  • Equal structures are not detected yet (Equal classes are going to be created over and over).
  • Properties named with funky names (like "!breaks", "|breaks", etc) or keyword (like "this", "break", "class", etc) will produce syntax errors.
  • Array of arrays are not supported:
[[{ "isThisSupported": false }]]
[{ "thisSupported": [{ "cool": true }] }]
Comments
  • 'List' is deprecated and shouldn't be used.

    'List' is deprecated and shouldn't be used.

    Warning message:

    'List' is deprecated and shouldn't be used. Try replacing the use of the deprecated member with the replacement.

    Generated code:

      LocationCoordinate.fromJson(Map<String, dynamic> json) {
        states = json['states'].cast<String>();
        if (json['results'] != null) {
          results = new List<Results>();
          json['results'].forEach((v) {
            results.add(new Results.fromJson(v));
          });
        }
      }
    
    enhancement good first issue 
    opened by iqfareez 5
  • New null safety does not let fromJson method to work

    New null safety does not let fromJson method to work

    The issue shown: Non-nullable instance field 'menu' must be initialized. Try adding an initializer expression, or add a field initializer in this constructor, or mark it 'late'.dart

    opened by tanmoy27112000 4
  • Unable to parse json

    Unable to parse json

    { "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": { "para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"] }, "GlossSee": "markup" } } } } }

    copy this json and put it in box and it unable to parse it .

    bug 
    opened by shakil807g 4
  • Update output on invalid input

    Update output on invalid input

    See

    {"bob":true,"thing": {"class": "Kevin"}}
    

    There is a lot of screaming in the terminal, but no user-visible error.

    bug 
    opened by kevmoo 4
  • Unable to convert valid json

    Unable to convert valid json

    My json which is asserted valid by jsonlint.com:

    [{"mailbox":"ct87ugz5","id":"5cd7baf5cfcdca06a3f07759","from":"hohg8z+dxzd795mt5gns","to":["\"[email protected]\" \[email protected]\u003e"],"subject":"Alstroemeria Record","date":"2019-05-12T14:19:33+08:00","size":1527,"seen":false}]
    

    Error:

    TypeError: Instance of 'JSArray': type 'JSArray' is not a subtype of type 'Map<String, dynamic>'
    
    bug 
    opened by Zhangzijing 3
  • Missing Parameter type for ('v')

    Missing Parameter type for ('v')

    When I paste the code to Android (Android Studio , Visual code ) it throws the following error: Missing Parameter type for ('v') The problem is here : json['data'].forEach((v) and also here data['data'] = this.data.map((v) => v.toJson()).toList();

    flutter --version
    Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
    Framework • revision 8661d8aecd (7 weeks ago) • 2019-02-14 19:19:53 -0800
    Engine • revision 3757390fa4
    Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
    
    class Autogenerated {
      NewOffer newOffer;
      SoldOffer soldOffer;
      HotOffer hotOffer;
      UsedOffer usedOffer;
      List<Countries> countries;
      List<TypeCompany> typeCompany;
      List<TopSearch> topSearch;
      List<Banner> banner;
      Config config;
      List<CompaniesName> companiesName;
      Diff diff;
    
      Autogenerated(
          {this.newOffer,
          this.soldOffer,
          this.hotOffer,
          this.usedOffer,
          this.countries,
          this.typeCompany,
          this.topSearch,
          this.banner,
          this.config,
          this.companiesName,
          this.diff});
    
      Autogenerated.fromJson(Map<String, dynamic> json) {
        newOffer = json['newOffer'] != null
            ? new NewOffer.fromJson(json['newOffer'])
            : null;
        soldOffer = json['soldOffer'] != null
            ? new SoldOffer.fromJson(json['soldOffer'])
            : null;
        hotOffer = json['hotOffer'] != null
            ? new HotOffer.fromJson(json['hotOffer'])
            : null;
        usedOffer = json['usedOffer'] != null
            ? new UsedOffer.fromJson(json['usedOffer'])
            : null;
        if (json['countries'] != null) {
          countries = new List<Countries>();
          json['countries'].forEach((v) {
            countries.add(new Countries.fromJson(v));
          });
        }
        if (json['typeCompany'] != null) {
          typeCompany = new List<TypeCompany>();
          json['typeCompany'].forEach((v) {
            typeCompany.add(new TypeCompany.fromJson(v));
          });
        }
        if (json['topSearch'] != null) {
          topSearch = new List<TopSearch>();
          json['topSearch'].forEach((v) {
            topSearch.add(new TopSearch.fromJson(v));
          });
        }
        if (json['banner'] != null) {
          banner = new List<Banner>();
          json['banner'].forEach((v) {
            banner.add(new Banner.fromJson(v));
          });
        }
        config =
            json['config'] != null ? new Config.fromJson(json['config']) : null;
        if (json['companiesName'] != null) {
          companiesName = new List<CompaniesName>();
          json['companiesName'].forEach((v) {
            companiesName.add(new CompaniesName.fromJson(v));
          });
        }
        diff = json['diff'] != null ? new Diff.fromJson(json['diff']) : null;
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        if (this.newOffer != null) {
          data['newOffer'] = this.newOffer.toJson();
        }
        if (this.soldOffer != null) {
          data['soldOffer'] = this.soldOffer.toJson();
        }
        if (this.hotOffer != null) {
          data['hotOffer'] = this.hotOffer.toJson();
        }
        if (this.usedOffer != null) {
          data['usedOffer'] = this.usedOffer.toJson();
        }
        if (this.countries != null) {
          data['countries'] = this.countries.map((v) => v.toJson()).toList();
        }
        if (this.typeCompany != null) {
          data['typeCompany'] = this.typeCompany.map((v) => v.toJson()).toList();
        }
        if (this.topSearch != null) {
          data['topSearch'] = this.topSearch.map((v) => v.toJson()).toList();
        }
        if (this.banner != null) {
          data['banner'] = this.banner.map((v) => v.toJson()).toList();
        }
        if (this.config != null) {
          data['config'] = this.config.toJson();
        }
        if (this.companiesName != null) {
          data['companiesName'] =
              this.companiesName.map((v) => v.toJson()).toList();
        }
        if (this.diff != null) {
          data['diff'] = this.diff.toJson();
        }
        return data;
      }
    }
    
    class NewOffer {
      int currentPage;
      List<Data> data;
      String firstPageUrl;
      int from;
      int lastPage;
      String lastPageUrl;
      Null nextPageUrl;
      String path;
      int perPage;
      Null prevPageUrl;
      int to;
      int total;
    
      NewOffer(
          {this.currentPage,
          this.data,
          this.firstPageUrl,
          this.from,
          this.lastPage,
          this.lastPageUrl,
          this.nextPageUrl,
          this.path,
          this.perPage,
          this.prevPageUrl,
          this.to,
          this.total});
    
      NewOffer.fromJson(Map<String, dynamic> json) {
        currentPage = json['current_page'];
        if (json['data'] != null) {
          data = new List<Data>();
          json['data'].forEach((v) {
            data.add(new Data.fromJson(v));
          });
        }
        firstPageUrl = json['first_page_url'];
        from = json['from'];
        lastPage = json['last_page'];
        lastPageUrl = json['last_page_url'];
        nextPageUrl = json['next_page_url'];
        path = json['path'];
        perPage = json['per_page'];
        prevPageUrl = json['prev_page_url'];
        to = json['to'];
        total = json['total'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['current_page'] = this.currentPage;
        if (this.data != null) {
          data['data'] = this.data.map((v) => v.toJson()).toList();
        }
        data['first_page_url'] = this.firstPageUrl;
        data['from'] = this.from;
        data['last_page'] = this.lastPage;
        data['last_page_url'] = this.lastPageUrl;
        data['next_page_url'] = this.nextPageUrl;
        data['path'] = this.path;
        data['per_page'] = this.perPage;
        data['prev_page_url'] = this.prevPageUrl;
        data['to'] = this.to;
        data['total'] = this.total;
        return data;
      }
    }
    
    class Data {
      int id;
      int companyId;
      int userId;
      String offerType;
      int isSold;
      int isAuction;
      int priceBefore;
      int priceAfter;
      String text;
      String endDate;
      int active;
      String updatedAt;
      String createdAt;
      String city;
      int sort;
      int state;
      int view;
      List<Images> images;
      List<SimilarOffer> similarOffer;
      Company company;
      List<OfferFeedBack> offerFeedBack;
      Rating rating;
      List<Specifications> specifications;
    
      Data(
          {this.id,
          this.companyId,
          this.userId,
          this.offerType,
          this.isSold,
          this.isAuction,
          this.priceBefore,
          this.priceAfter,
          this.text,
          this.endDate,
          this.active,
          this.updatedAt,
          this.createdAt,
          this.city,
          this.sort,
          this.state,
          this.view,
          this.images,
          this.similarOffer,
          this.company,
          this.offerFeedBack,
          this.rating,
          this.specifications});
    
      Data.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        companyId = json['company_id'];
        userId = json['user_id'];
        offerType = json['offer_type'];
        isSold = json['is_sold'];
        isAuction = json['is_auction'];
        priceBefore = json['price_before'];
        priceAfter = json['price_after'];
        text = json['text'];
        endDate = json['end_date'];
        active = json['active'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
        city = json['city'];
        sort = json['sort'];
        state = json['state'];
        view = json['view'];
        if (json['images'] != null) {
          images = new List<Images>();
          json['images'].forEach((v) {
            images.add(new Images.fromJson(v));
          });
        }
        if (json['similar_offer'] != null) {
          similarOffer = new List<SimilarOffer>();
          json['similar_offer'].forEach((v) {
            similarOffer.add(new SimilarOffer.fromJson(v));
          });
        }
        company =
            json['company'] != null ? new Company.fromJson(json['company']) : null;
        if (json['offer_feed_back'] != null) {
          offerFeedBack = new List<OfferFeedBack>();
          json['offer_feed_back'].forEach((v) {
            offerFeedBack.add(new OfferFeedBack.fromJson(v));
          });
        }
        rating =
            json['rating'] != null ? new Rating.fromJson(json['rating']) : null;
        if (json['specifications'] != null) {
          specifications = new List<Specifications>();
          json['specifications'].forEach((v) {
            specifications.add(new Specifications.fromJson(v));
          });
        }
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['company_id'] = this.companyId;
        data['user_id'] = this.userId;
        data['offer_type'] = this.offerType;
        data['is_sold'] = this.isSold;
        data['is_auction'] = this.isAuction;
        data['price_before'] = this.priceBefore;
        data['price_after'] = this.priceAfter;
        data['text'] = this.text;
        data['end_date'] = this.endDate;
        data['active'] = this.active;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        data['city'] = this.city;
        data['sort'] = this.sort;
        data['state'] = this.state;
        data['view'] = this.view;
        if (this.images != null) {
          data['images'] = this.images.map((v) => v.toJson()).toList();
        }
        if (this.similarOffer != null) {
          data['similar_offer'] = this.similarOffer.map((v) => v.toJson()).toList();
        }
        if (this.company != null) {
          data['company'] = this.company.toJson();
        }
        if (this.offerFeedBack != null) {
          data['offer_feed_back'] =
              this.offerFeedBack.map((v) => v.toJson()).toList();
        }
        if (this.rating != null) {
          data['rating'] = this.rating.toJson();
        }
        if (this.specifications != null) {
          data['specifications'] =
              this.specifications.map((v) => v.toJson()).toList();
        }
        return data;
      }
    }
    
    class Images {
      int id;
      int offerId;
      String path;
      String createdAt;
      Null updatedAt;
    
      Images({this.id, this.offerId, this.path, this.createdAt, this.updatedAt});
    
      Images.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        offerId = json['offer_id'];
        path = json['path'];
        createdAt = json['created_at'];
        updatedAt = json['updated_at'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['offer_id'] = this.offerId;
        data['path'] = this.path;
        data['created_at'] = this.createdAt;
        data['updated_at'] = this.updatedAt;
        return data;
      }
    }
    
    class SimilarOffer {
      int id;
      int companyId;
      int userId;
      String offerType;
      int isSold;
      int isAuction;
      int priceBefore;
      int priceAfter;
      String text;
      String endDate;
      int active;
      String updatedAt;
      String createdAt;
      String city;
      int sort;
      int state;
      int view;
      List<Images> images;
      Company company;
      List<OfferFeedBack> offerFeedBack;
      List<Specifications> specifications;
      Rating rating;
    
      SimilarOffer(
          {this.id,
          this.companyId,
          this.userId,
          this.offerType,
          this.isSold,
          this.isAuction,
          this.priceBefore,
          this.priceAfter,
          this.text,
          this.endDate,
          this.active,
          this.updatedAt,
          this.createdAt,
          this.city,
          this.sort,
          this.state,
          this.view,
          this.images,
          this.company,
          this.offerFeedBack,
          this.specifications,
          this.rating});
    
      SimilarOffer.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        companyId = json['company_id'];
        userId = json['user_id'];
        offerType = json['offer_type'];
        isSold = json['is_sold'];
        isAuction = json['is_auction'];
        priceBefore = json['price_before'];
        priceAfter = json['price_after'];
        text = json['text'];
        endDate = json['end_date'];
        active = json['active'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
        city = json['city'];
        sort = json['sort'];
        state = json['state'];
        view = json['view'];
        if (json['images'] != null) {
          images = new List<Images>();
          json['images'].forEach((v) {
            images.add(new Images.fromJson(v));
          });
        }
        company =
            json['company'] != null ? new Company.fromJson(json['company']) : null;
        if (json['offer_feed_back'] != null) {
          offerFeedBack = new List<OfferFeedBack>();
          json['offer_feed_back'].forEach((v) {
            offerFeedBack.add(new OfferFeedBack.fromJson(v));
          });
        }
        if (json['specifications'] != null) {
          specifications = new List<Specifications>();
          json['specifications'].forEach((v) {
            specifications.add(new Specifications.fromJson(v));
          });
        }
        rating =
            json['rating'] != null ? new Rating.fromJson(json['rating']) : null;
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['company_id'] = this.companyId;
        data['user_id'] = this.userId;
        data['offer_type'] = this.offerType;
        data['is_sold'] = this.isSold;
        data['is_auction'] = this.isAuction;
        data['price_before'] = this.priceBefore;
        data['price_after'] = this.priceAfter;
        data['text'] = this.text;
        data['end_date'] = this.endDate;
        data['active'] = this.active;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        data['city'] = this.city;
        data['sort'] = this.sort;
        data['state'] = this.state;
        data['view'] = this.view;
        if (this.images != null) {
          data['images'] = this.images.map((v) => v.toJson()).toList();
        }
        if (this.company != null) {
          data['company'] = this.company.toJson();
        }
        if (this.offerFeedBack != null) {
          data['offer_feed_back'] =
              this.offerFeedBack.map((v) => v.toJson()).toList();
        }
        if (this.specifications != null) {
          data['specifications'] =
              this.specifications.map((v) => v.toJson()).toList();
        }
        if (this.rating != null) {
          data['rating'] = this.rating.toJson();
        }
        return data;
      }
    }
    
    class Company {
      int id;
      String name;
      String logo;
      String mobile;
      int userId;
      int companyTypeId;
      Null createdAt;
      Null updatedAt;
      String facadeUrl;
      List<CompanyBranches> companyBranches;
    
      Company(
          {this.id,
          this.name,
          this.logo,
          this.mobile,
          this.userId,
          this.companyTypeId,
          this.createdAt,
          this.updatedAt,
          this.facadeUrl,
          this.companyBranches});
    
      Company.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        name = json['name'];
        logo = json['logo'];
        mobile = json['mobile'];
        userId = json['user_id'];
        companyTypeId = json['company_type_id'];
        createdAt = json['created_at'];
        updatedAt = json['updated_at'];
        facadeUrl = json['facade_url'];
        if (json['company_branches'] != null) {
          companyBranches = new List<CompanyBranches>();
          json['company_branches'].forEach((v) {
            companyBranches.add(new CompanyBranches.fromJson(v));
          });
        }
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['name'] = this.name;
        data['logo'] = this.logo;
        data['mobile'] = this.mobile;
        data['user_id'] = this.userId;
        data['company_type_id'] = this.companyTypeId;
        data['created_at'] = this.createdAt;
        data['updated_at'] = this.updatedAt;
        data['facade_url'] = this.facadeUrl;
        if (this.companyBranches != null) {
          data['company_branches'] =
              this.companyBranches.map((v) => v.toJson()).toList();
        }
        return data;
      }
    }
    
    class CompanyBranches {
      int id;
      int companyId;
      String address;
      String phone;
      String city;
      String area;
      Null updatedAt;
      Null createdAt;
    
      CompanyBranches(
          {this.id,
          this.companyId,
          this.address,
          this.phone,
          this.city,
          this.area,
          this.updatedAt,
          this.createdAt});
    
      CompanyBranches.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        companyId = json['company_id'];
        address = json['address'];
        phone = json['phone'];
        city = json['city'];
        area = json['area'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['company_id'] = this.companyId;
        data['address'] = this.address;
        data['phone'] = this.phone;
        data['city'] = this.city;
        data['area'] = this.area;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        return data;
      }
    }
    
    class OfferFeedBack {
      int id;
      int offerId;
      int userId;
      String feedback;
      String createdAt;
      Null updatedAt;
      User user;
    
      OfferFeedBack(
          {this.id,
          this.offerId,
          this.userId,
          this.feedback,
          this.createdAt,
          this.updatedAt,
          this.user});
    
      OfferFeedBack.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        offerId = json['offer_id'];
        userId = json['user_id'];
        feedback = json['feedback'];
        createdAt = json['created_at'];
        updatedAt = json['updated_at'];
        user = json['user'] != null ? new User.fromJson(json['user']) : null;
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['offer_id'] = this.offerId;
        data['user_id'] = this.userId;
        data['feedback'] = this.feedback;
        data['created_at'] = this.createdAt;
        data['updated_at'] = this.updatedAt;
        if (this.user != null) {
          data['user'] = this.user.toJson();
        }
        return data;
      }
    }
    
    class User {
      int id;
      String username;
      String imageUrl;
    
      User({this.id, this.username, this.imageUrl});
    
      User.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        username = json['username'];
        imageUrl = json['image_url'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['username'] = this.username;
        data['image_url'] = this.imageUrl;
        return data;
      }
    }
    
    class Specifications {
      int id;
      int specificationsId;
      String val;
      int offerId;
      Null updatedAt;
      Null createdAt;
      SpecificationsType specificationsType;
    
      Specifications(
          {this.id,
          this.specificationsId,
          this.val,
          this.offerId,
          this.updatedAt,
          this.createdAt,
          this.specificationsType});
    
      Specifications.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        specificationsId = json['specifications_id'];
        val = json['val'];
        offerId = json['offer_id'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
        specificationsType = json['specifications_type'] != null
            ? new SpecificationsType.fromJson(json['specifications_type'])
            : null;
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['specifications_id'] = this.specificationsId;
        data['val'] = this.val;
        data['offer_id'] = this.offerId;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        if (this.specificationsType != null) {
          data['specifications_type'] = this.specificationsType.toJson();
        }
        return data;
      }
    }
    
    class SpecificationsType {
      int id;
      String specificationsType;
      String specificationsIcon;
      int companyTypeId;
      Null updatedAt;
      String createdAt;
    
      SpecificationsType(
          {this.id,
          this.specificationsType,
          this.specificationsIcon,
          this.companyTypeId,
          this.updatedAt,
          this.createdAt});
    
      SpecificationsType.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        specificationsType = json['specifications_type'];
        specificationsIcon = json['specifications_icon'];
        companyTypeId = json['company_type_id'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['specifications_type'] = this.specificationsType;
        data['specifications_icon'] = this.specificationsIcon;
        data['company_type_id'] = this.companyTypeId;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        return data;
      }
    }
    
    class Rating {
      int offerId;
      double raiting;
    
      Rating({this.offerId, this.raiting});
    
      Rating.fromJson(Map<String, dynamic> json) {
        offerId = json['offer_id'];
        raiting = json['raiting'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['offer_id'] = this.offerId;
        data['raiting'] = this.raiting;
        return data;
      }
    }
    
    class SoldOffer {
      int currentPage;
      List<Data> data;
      String firstPageUrl;
      int from;
      int lastPage;
      String lastPageUrl;
      Null nextPageUrl;
      String path;
      int perPage;
      Null prevPageUrl;
      int to;
      int total;
    
      SoldOffer(
          {this.currentPage,
          this.data,
          this.firstPageUrl,
          this.from,
          this.lastPage,
          this.lastPageUrl,
          this.nextPageUrl,
          this.path,
          this.perPage,
          this.prevPageUrl,
          this.to,
          this.total});
    
      SoldOffer.fromJson(Map<String, dynamic> json) {
        currentPage = json['current_page'];
        if (json['data'] != null) {
          data = new List<Data>();
          json['data'].forEach((v) {
            data.add(new Data.fromJson(v));
          });
        }
        firstPageUrl = json['first_page_url'];
        from = json['from'];
        lastPage = json['last_page'];
        lastPageUrl = json['last_page_url'];
        nextPageUrl = json['next_page_url'];
        path = json['path'];
        perPage = json['per_page'];
        prevPageUrl = json['prev_page_url'];
        to = json['to'];
        total = json['total'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['current_page'] = this.currentPage;
        if (this.data != null) {
          data['data'] = this.data.map((v) => v.toJson()).toList();
        }
        data['first_page_url'] = this.firstPageUrl;
        data['from'] = this.from;
        data['last_page'] = this.lastPage;
        data['last_page_url'] = this.lastPageUrl;
        data['next_page_url'] = this.nextPageUrl;
        data['path'] = this.path;
        data['per_page'] = this.perPage;
        data['prev_page_url'] = this.prevPageUrl;
        data['to'] = this.to;
        data['total'] = this.total;
        return data;
      }
    }
    
    class Data {
      int id;
      int companyId;
      int userId;
      String offerType;
      int isSold;
      int isAuction;
      int priceBefore;
      int priceAfter;
      String text;
      String endDate;
      int active;
      String updatedAt;
      String createdAt;
      String city;
      int sort;
      int state;
      int view;
      List<Images> images;
      List<SimilarOffer> similarOffer;
      Company company;
      List<Null> offerFeedBack;
      Null rating;
      List<Null> specifications;
    
      Data(
          {this.id,
          this.companyId,
          this.userId,
          this.offerType,
          this.isSold,
          this.isAuction,
          this.priceBefore,
          this.priceAfter,
          this.text,
          this.endDate,
          this.active,
          this.updatedAt,
          this.createdAt,
          this.city,
          this.sort,
          this.state,
          this.view,
          this.images,
          this.similarOffer,
          this.company,
          this.offerFeedBack,
          this.rating,
          this.specifications});
    
      Data.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        companyId = json['company_id'];
        userId = json['user_id'];
        offerType = json['offer_type'];
        isSold = json['is_sold'];
        isAuction = json['is_auction'];
        priceBefore = json['price_before'];
        priceAfter = json['price_after'];
        text = json['text'];
        endDate = json['end_date'];
        active = json['active'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
        city = json['city'];
        sort = json['sort'];
        state = json['state'];
        view = json['view'];
        if (json['images'] != null) {
          images = new List<Images>();
          json['images'].forEach((v) {
            images.add(new Images.fromJson(v));
          });
        }
        if (json['similar_offer'] != null) {
          similarOffer = new List<SimilarOffer>();
          json['similar_offer'].forEach((v) {
            similarOffer.add(new SimilarOffer.fromJson(v));
          });
        }
        company =
            json['company'] != null ? new Company.fromJson(json['company']) : null;
        if (json['offer_feed_back'] != null) {
          offerFeedBack = new List<Null>();
          json['offer_feed_back'].forEach((v) {
            offerFeedBack.add(new Null.fromJson(v));
          });
        }
        rating = json['rating'];
        if (json['specifications'] != null) {
          specifications = new List<Null>();
          json['specifications'].forEach((v) {
            specifications.add(new Null.fromJson(v));
          });
        }
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['company_id'] = this.companyId;
        data['user_id'] = this.userId;
        data['offer_type'] = this.offerType;
        data['is_sold'] = this.isSold;
        data['is_auction'] = this.isAuction;
        data['price_before'] = this.priceBefore;
        data['price_after'] = this.priceAfter;
        data['text'] = this.text;
        data['end_date'] = this.endDate;
        data['active'] = this.active;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        data['city'] = this.city;
        data['sort'] = this.sort;
        data['state'] = this.state;
        data['view'] = this.view;
        if (this.images != null) {
          data['images'] = this.images.map((v) => v.toJson()).toList();
        }
        if (this.similarOffer != null) {
          data['similar_offer'] = this.similarOffer.map((v) => v.toJson()).toList();
        }
        if (this.company != null) {
          data['company'] = this.company.toJson();
        }
        if (this.offerFeedBack != null) {
          data['offer_feed_back'] =
              this.offerFeedBack.map((v) => v.toJson()).toList();
        }
        data['rating'] = this.rating;
        if (this.specifications != null) {
          data['specifications'] =
              this.specifications.map((v) => v.toJson()).toList();
        }
        return data;
      }
    }
    
    class SimilarOffer {
      int id;
      int companyId;
      int userId;
      String offerType;
      int isSold;
      int isAuction;
      int priceBefore;
      int priceAfter;
      String text;
      String endDate;
      int active;
      String updatedAt;
      String createdAt;
      String city;
      int sort;
      int state;
      int view;
      List<Images> images;
      Company company;
      List<Null> offerFeedBack;
      List<Null> specifications;
      Null rating;
    
      SimilarOffer(
          {this.id,
          this.companyId,
          this.userId,
          this.offerType,
          this.isSold,
          this.isAuction,
          this.priceBefore,
          this.priceAfter,
          this.text,
          this.endDate,
          this.active,
          this.updatedAt,
          this.createdAt,
          this.city,
          this.sort,
          this.state,
          this.view,
          this.images,
          this.company,
          this.offerFeedBack,
          this.specifications,
          this.rating});
    
      SimilarOffer.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        companyId = json['company_id'];
        userId = json['user_id'];
        offerType = json['offer_type'];
        isSold = json['is_sold'];
        isAuction = json['is_auction'];
        priceBefore = json['price_before'];
        priceAfter = json['price_after'];
        text = json['text'];
        endDate = json['end_date'];
        active = json['active'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
        city = json['city'];
        sort = json['sort'];
        state = json['state'];
        view = json['view'];
        if (json['images'] != null) {
          images = new List<Images>();
          json['images'].forEach((v) {
            images.add(new Images.fromJson(v));
          });
        }
        company =
            json['company'] != null ? new Company.fromJson(json['company']) : null;
        if (json['offer_feed_back'] != null) {
          offerFeedBack = new List<Null>();
          json['offer_feed_back'].forEach((v) {
            offerFeedBack.add(new Null.fromJson(v));
          });
        }
        if (json['specifications'] != null) {
          specifications = new List<Null>();
          json['specifications'].forEach((v) {
            specifications.add(new Null.fromJson(v));
          });
        }
        rating = json['rating'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['company_id'] = this.companyId;
        data['user_id'] = this.userId;
        data['offer_type'] = this.offerType;
        data['is_sold'] = this.isSold;
        data['is_auction'] = this.isAuction;
        data['price_before'] = this.priceBefore;
        data['price_after'] = this.priceAfter;
        data['text'] = this.text;
        data['end_date'] = this.endDate;
        data['active'] = this.active;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        data['city'] = this.city;
        data['sort'] = this.sort;
        data['state'] = this.state;
        data['view'] = this.view;
        if (this.images != null) {
          data['images'] = this.images.map((v) => v.toJson()).toList();
        }
        if (this.company != null) {
          data['company'] = this.company.toJson();
        }
        if (this.offerFeedBack != null) {
          data['offer_feed_back'] =
              this.offerFeedBack.map((v) => v.toJson()).toList();
        }
        if (this.specifications != null) {
          data['specifications'] =
              this.specifications.map((v) => v.toJson()).toList();
        }
        data['rating'] = this.rating;
        return data;
      }
    }
    
    class HotOffer {
      int currentPage;
      List<Data> data;
      String firstPageUrl;
      int from;
      int lastPage;
      String lastPageUrl;
      Null nextPageUrl;
      String path;
      int perPage;
      Null prevPageUrl;
      int to;
      int total;
    
      HotOffer(
          {this.currentPage,
          this.data,
          this.firstPageUrl,
          this.from,
          this.lastPage,
          this.lastPageUrl,
          this.nextPageUrl,
          this.path,
          this.perPage,
          this.prevPageUrl,
          this.to,
          this.total});
    
      HotOffer.fromJson(Map<String, dynamic> json) {
        currentPage = json['current_page'];
        if (json['data'] != null) {
          data = new List<Data>();
          json['data'].forEach((v) {
            data.add(new Data.fromJson(v));
          });
        }
        firstPageUrl = json['first_page_url'];
        from = json['from'];
        lastPage = json['last_page'];
        lastPageUrl = json['last_page_url'];
        nextPageUrl = json['next_page_url'];
        path = json['path'];
        perPage = json['per_page'];
        prevPageUrl = json['prev_page_url'];
        to = json['to'];
        total = json['total'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['current_page'] = this.currentPage;
        if (this.data != null) {
          data['data'] = this.data.map((v) => v.toJson()).toList();
        }
        data['first_page_url'] = this.firstPageUrl;
        data['from'] = this.from;
        data['last_page'] = this.lastPage;
        data['last_page_url'] = this.lastPageUrl;
        data['next_page_url'] = this.nextPageUrl;
        data['path'] = this.path;
        data['per_page'] = this.perPage;
        data['prev_page_url'] = this.prevPageUrl;
        data['to'] = this.to;
        data['total'] = this.total;
        return data;
      }
    }
    
    class UsedOffer {
      int currentPage;
      List<Data> data;
      String firstPageUrl;
      int from;
      int lastPage;
      String lastPageUrl;
      Null nextPageUrl;
      String path;
      int perPage;
      Null prevPageUrl;
      int to;
      int total;
    
      UsedOffer(
          {this.currentPage,
          this.data,
          this.firstPageUrl,
          this.from,
          this.lastPage,
          this.lastPageUrl,
          this.nextPageUrl,
          this.path,
          this.perPage,
          this.prevPageUrl,
          this.to,
          this.total});
    
      UsedOffer.fromJson(Map<String, dynamic> json) {
        currentPage = json['current_page'];
        if (json['data'] != null) {
          data = new List<Data>();
          json['data'].forEach((v) {
            data.add(new Data.fromJson(v));
          });
        }
        firstPageUrl = json['first_page_url'];
        from = json['from'];
        lastPage = json['last_page'];
        lastPageUrl = json['last_page_url'];
        nextPageUrl = json['next_page_url'];
        path = json['path'];
        perPage = json['per_page'];
        prevPageUrl = json['prev_page_url'];
        to = json['to'];
        total = json['total'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['current_page'] = this.currentPage;
        if (this.data != null) {
          data['data'] = this.data.map((v) => v.toJson()).toList();
        }
        data['first_page_url'] = this.firstPageUrl;
        data['from'] = this.from;
        data['last_page'] = this.lastPage;
        data['last_page_url'] = this.lastPageUrl;
        data['next_page_url'] = this.nextPageUrl;
        data['path'] = this.path;
        data['per_page'] = this.perPage;
        data['prev_page_url'] = this.prevPageUrl;
        data['to'] = this.to;
        data['total'] = this.total;
        return data;
      }
    }
    
    class Countries {
      int id;
      String country;
      Null updatedAt;
      String createdAt;
      List<Cities> cities;
    
      Countries(
          {this.id, this.country, this.updatedAt, this.createdAt, this.cities});
    
      Countries.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        country = json['country'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
        if (json['cities'] != null) {
          cities = new List<Cities>();
          json['cities'].forEach((v) {
            cities.add(new Cities.fromJson(v));
          });
        }
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['country'] = this.country;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        if (this.cities != null) {
          data['cities'] = this.cities.map((v) => v.toJson()).toList();
        }
        return data;
      }
    }
    
    class Cities {
      int id;
      String city;
      String country;
      String updatedAt;
      Null createdAt;
      List<Areas> areas;
    
      Cities(
          {this.id,
          this.city,
          this.country,
          this.updatedAt,
          this.createdAt,
          this.areas});
    
      Cities.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        city = json['city'];
        country = json['country'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
        if (json['areas'] != null) {
          areas = new List<Areas>();
          json['areas'].forEach((v) {
            areas.add(new Areas.fromJson(v));
          });
        }
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['city'] = this.city;
        data['country'] = this.country;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        if (this.areas != null) {
          data['areas'] = this.areas.map((v) => v.toJson()).toList();
        }
        return data;
      }
    }
    
    class Areas {
      int id;
      String area;
      String city;
      Null updatedAt;
      Null createdAt;
    
      Areas({this.id, this.area, this.city, this.updatedAt, this.createdAt});
    
      Areas.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        area = json['area'];
        city = json['city'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['area'] = this.area;
        data['city'] = this.city;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        return data;
      }
    }
    
    class TypeCompany {
      int id;
      String companyType;
      String companyTypeIcon;
      Null updatedAt;
      Null createdAt;
      List<TypeOffers> typeOffers;
      List<SpecificationsType> specificationsType;
    
      TypeCompany(
          {this.id,
          this.companyType,
          this.companyTypeIcon,
          this.updatedAt,
          this.createdAt,
          this.typeOffers,
          this.specificationsType});
    
      TypeCompany.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        companyType = json['company_type'];
        companyTypeIcon = json['company_type_icon'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
        if (json['type_offers'] != null) {
          typeOffers = new List<TypeOffers>();
          json['type_offers'].forEach((v) {
            typeOffers.add(new TypeOffers.fromJson(v));
          });
        }
        if (json['specifications_type'] != null) {
          specificationsType = new List<SpecificationsType>();
          json['specifications_type'].forEach((v) {
            specificationsType.add(new SpecificationsType.fromJson(v));
          });
        }
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['company_type'] = this.companyType;
        data['company_type_icon'] = this.companyTypeIcon;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        if (this.typeOffers != null) {
          data['type_offers'] = this.typeOffers.map((v) => v.toJson()).toList();
        }
        if (this.specificationsType != null) {
          data['specifications_type'] =
              this.specificationsType.map((v) => v.toJson()).toList();
        }
        return data;
      }
    }
    
    class TypeOffers {
      int id;
      String offerType;
      int companyTypeId;
      Null updatedAt;
      Null createdAt;
    
      TypeOffers(
          {this.id,
          this.offerType,
          this.companyTypeId,
          this.updatedAt,
          this.createdAt});
    
      TypeOffers.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        offerType = json['offer_type'];
        companyTypeId = json['company_type_id'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['offer_type'] = this.offerType;
        data['company_type_id'] = this.companyTypeId;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        return data;
      }
    }
    
    class TopSearch {
      String searchText;
      int count;
    
      TopSearch({this.searchText, this.count});
    
      TopSearch.fromJson(Map<String, dynamic> json) {
        searchText = json['search_text'];
        count = json['count'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['search_text'] = this.searchText;
        data['count'] = this.count;
        return data;
      }
    }
    
    class Banner {
      int id;
      int companyId;
      Null updatedAt;
      Null createdAt;
      String name;
      String logo;
      String mobile;
      int userId;
      int companyTypeId;
      String facadeUrl;
    
      Banner(
          {this.id,
          this.companyId,
          this.updatedAt,
          this.createdAt,
          this.name,
          this.logo,
          this.mobile,
          this.userId,
          this.companyTypeId,
          this.facadeUrl});
    
      Banner.fromJson(Map<String, dynamic> json) {
        id = json['id'];
        companyId = json['company_id'];
        updatedAt = json['updated_at'];
        createdAt = json['created_at'];
        name = json['name'];
        logo = json['logo'];
        mobile = json['mobile'];
        userId = json['user_id'];
        companyTypeId = json['company_type_id'];
        facadeUrl = json['facade_url'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['id'] = this.id;
        data['company_id'] = this.companyId;
        data['updated_at'] = this.updatedAt;
        data['created_at'] = this.createdAt;
        data['name'] = this.name;
        data['logo'] = this.logo;
        data['mobile'] = this.mobile;
        data['user_id'] = this.userId;
        data['company_type_id'] = this.companyTypeId;
        data['facade_url'] = this.facadeUrl;
        return data;
      }
    }
    
    class Config {
      int isViews;
      int isMotionEffect;
      String color;
      int vestionCode;
      String motionUrl;
      int isShouldUpdate;
    
      Config(
          {this.isViews,
          this.isMotionEffect,
          this.color,
          this.vestionCode,
          this.motionUrl,
          this.isShouldUpdate});
    
      Config.fromJson(Map<String, dynamic> json) {
        isViews = json['is_views'];
        isMotionEffect = json['is_motion_effect'];
        color = json['color'];
        vestionCode = json['vestion_code'];
        motionUrl = json['motion_url'];
        isShouldUpdate = json['is_should_update'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['is_views'] = this.isViews;
        data['is_motion_effect'] = this.isMotionEffect;
        data['color'] = this.color;
        data['vestion_code'] = this.vestionCode;
        data['motion_url'] = this.motionUrl;
        data['is_should_update'] = this.isShouldUpdate;
        return data;
      }
    }
    
    class CompaniesName {
      String name;
    
      CompaniesName({this.name});
    
      CompaniesName.fromJson(Map<String, dynamic> json) {
        name = json['name'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['name'] = this.name;
        return data;
      }
    }
    
    class Diff {
      String endDate;
      int diff;
    
      Diff({this.endDate, this.diff});
    
      Diff.fromJson(Map<String, dynamic> json) {
        endDate = json['end_date'];
        diff = json['diff'];
      }
    
      Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['end_date'] = this.endDate;
        data['diff'] = this.diff;
        return data;
      }
    }
    
    question 
    opened by Abdohurbly 3
  • Cannot generate dart code. Please check the project caveats.

    Cannot generate dart code. Please check the project caveats.

    myjson response like below but always cannot generate [ { "name": "System Management", "path": "/system", "redirect": "noredirect", "component": "Layout", "alwaysShow": true, "meta": { "title": "System Management", "icon": "system" }, "children": [ { "name": "User Management", "path": "user", "component": "system/user/index", "meta": { "title": "User Management", "icon": "peoples" } }, { "name": "Role management", "path": "role", "component": "system/role/index", "meta": { "title": "Role management", "icon": "role" } }, { "name": "Authority management", "path": "permission", "component": "system/permission/index", "meta": { "title": "Authority management", "icon": "permission" } }, { "name": "Menu management", "path": "menu", "component": "system/menu/index", "meta": { "title": "Menu management", "icon": "menu" } }, { "name": "Department management", "path": "dept", "component": "system/dept/index", "meta": { "title": "Department management", "icon": "dept" } }, { "name": "Job management", "path": "job", "component": "system/job/index", "meta": { "title": "Job management", "icon": "Steve-Jobs" } }, { "name": "Dictionary management", "path": "dict", "component": "system/dict/index", "meta": { "title": "Dictionary management", "icon": "dictionary" } } ] }, { "name": "System monitoring", "path": "/monitor", "redirect": "noredirect", "component": "Layout", "alwaysShow": true, "meta": { "title": "System monitoring", "icon": "monitor" }, "children": [ { "name": "Operation log", "path": "logs", "component": "monitor/log/index", "meta": { "title": "Operation log", "icon": "log" } }, { "name": "Exception log", "path": "errorLog", "component": "monitor/log/errorLog", "meta": { "title": "Exception log", "icon": "error" } }, { "name": "System cache", "path": "redis", "component": "monitor/redis/index", "meta": { "title": "System cache", "icon": "redis" } }, { "name": "SQL monitoring", "path": "druid", "component": "monitor/sql/index", "meta": { "title": "SQL monitoring", "icon": "sqlMonitor" } } ] }, { "path": "/logbook", "component": "Layout", "children": [ { "name": "Log Book ", "path": "index", "component": "logbook/index", "meta": { "title": "Log Book ", "icon": "tools" } } ] }, { "name": "Master Data", "path": "/", "redirect": "noredirect", "component": "Layout", "alwaysShow": true, "meta": { "title": "Master Data", "icon": "tools" }, "children": [ { "name": "category", "path": "category", "component": "master/category/index", "meta": { "title": "category", "icon": "category" } }, { "name": "item", "path": "item", "component": "master/item/index", "meta": { "title": "item", "icon": "sys-tools" } } ] }, { "name": "System Tool", "path": "/sys-tools", "redirect": "noredirect", "component": "Layout", "alwaysShow": true, "meta": { "title": "System Tool", "icon": "sys-tools" }, "children": [ { "name": "Timed task\r\n", "path": "timing", "component": "system/timing/index", "meta": { "title": "Timed task\r\n", "icon": "timing" } }, { "name": "Swagger", "path": "swagger2", "component": "tools/swagger/index", "meta": { "title": "Swagger", "icon": "swagger" } }, { "name": "Mail tool", "path": "email", "component": "tools/email/index", "meta": { "title": "Mail tool", "icon": "email" } }, { "name": "Image Management", "path": "pictures", "component": "tools/picture/index", "meta": { "title": "Image Management", "icon": "image" } }, { "name": "Qiniu cloud storage", "path": "qiniu", "component": "tools/qiniu/index", "meta": { "title": "Qiniu cloud storage", "icon": "qiniu" } } ] }, { "name": "CMS", "path": "/cms", "redirect": "noredirect", "component": "Layout", "alwaysShow": true, "meta": { "title": "CMS", "icon": "system" }, "children": [ { "name": "home", "path": "home", "redirect": "noredirect", "component": "cms/home/index", "alwaysShow": true, "meta": { "title": "home", "icon": "home" }, "children": [ { "name": "corousel", "path": "corousel", "component": "cms/home/corousel/index", "meta": { "title": "corousel", "icon": "icon" } }, { "name": "team", "path": "team", "component": "cms/home/team/index", "meta": { "title": "team", "icon": "user" } } ] }, { "name": "gallery", "path": "gallery", "component": "cms/gallery/index", "meta": { "title": "gallery", "icon": "image" } }, { "name": "video", "path": "video", "component": "cms/video/index", "meta": { "title": "video", "icon": "film-strip" } }, { "name": "news", "path": "news", "component": "cms/news/index", "meta": { "title": "news", "icon": "fwb" } } ] }, { "name": "Problem", "path": "/problem", "redirect": "noredirect", "component": "Layout", "alwaysShow": true, "meta": { "title": "Problem", "icon": "log" }, "children": [ { "name": "List Problem", "path": "problem list", "component": "problem/index", "meta": { "title": "List Problem", "icon": "dev" } }, { "name": "Unassigne", "path": "unassgine", "component": "problem/index1", "meta": { "title": "Unassigne", "icon": "develop" } } ] }, { "path": "/jobdesk", "component": "Layout", "children": [ { "name": "Jobdesk", "path": "index", "component": "jobdesk/index", "meta": { "title": "Jobdesk", "icon": "monitor" } } ] }, { "path": "/containeryard", "component": "Layout", "children": [ { "name": "Container Yard", "path": "index", "component": "containeryard/index", "meta": { "title": "Container Yard", "icon": "image" } } ] }, { "path": "/bongkarmuat", "component": "Layout", "children": [ { "name": "Bongkar Muat", "path": "index", "component": "bongkarmuat/index", "meta": { "title": "Bongkar Muat", "icon": "codeConsole" } } ] } ]

    opened by tobitoi 2
  • Excuse me.help,please.

    Excuse me.help,please.

    部分格式的json数据无法转换.比如 : Partial json data cannot be converted. For example:

    http://tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.billboard.billList&type=2&size=10&offset=0

    image

    opened by pheromone 2
  • Add copy button to top right of code window

    Add copy button to top right of code window

    I've been copy pasting code on and off all day, and having a "Copy" button that put the contents of the code box into the clipboard would be great. Loving the tool.

    Something like this.

    enhancement 
    opened by MegaMattMiller 2
  • How can I keep field name unmodified

    How can I keep field name unmodified

    When json has a name with underline, it will convert to hump name. Like

    {
    "product_id": 1
    }
    

    will generate

    class Product {
      int productId;
    

    product_id -> productId. I think it's correspond to dart code style.

    But how can I keep the name untouched if I want.

    opened by huhuang03 1
  • Can this be made into a package?

    Can this be made into a package?

    You can make this into a package, and when you add your package to the flutter project, you create a json file that you want to generate the dart class, and then type the generate command at the terminal to generate the corresponding dart class file

    😂I do not know if there is a package with similar functions, I am looking forward to it!!

    opened by GanZhiXiong 1
  • Convert float to int

    Convert float to int

    I used the site to create my model after giving it a json file, floats in my data were converted to integers. Took me some time do understand what happened. Kindly add a note for that on the site or set double if json has double. Thank you.

    opened by leenjiru 0
  • Missing Parameter type for 'v',

    Missing Parameter type for 'v',

    Here is my code

    In line 8, I am getting the error " Missing Parameter type 'v' "

    `class Delivery_Valets { List? result; int? totalCount;

    Delivery_Valets({this.result, this.totalCount});

    Delivery_Valets.fromJson(Map<String, dynamic> json) { if (json['result'] != null) { result = []; json['result'].forEach((v) { result!.add(new Result.fromJson(v)); }); } totalCount = json['totalCount']; }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.result != null) { data['result'] = this.result!.map((v) => v.toJson()).toList(); } data['totalCount'] = this.totalCount; return data; } }

    class Result { String? sId; int? phoneNumber; int? iV; String? accountStatus; String? accountType; List? addresses; String? createdAt; Location? location; String? updatedAt; String? userType; Verification? verification; String? email; String? gender; String? name; Null? profileImageUrl; String? vehicleType;

    Result( {this.sId, this.phoneNumber, this.iV, this.accountStatus, this.accountType, this.addresses, this.createdAt, this.location, this.updatedAt, this.userType, this.verification, this.email, this.gender, this.name, this.profileImageUrl, this.vehicleType});

    Result.fromJson(Map<String, dynamic> json) { sId = json['_id']; phoneNumber = json['phoneNumber']; iV = json['__v']; accountStatus = json['accountStatus']; accountType = json['accountType']; if (json['addresses'] != null) { addresses = []; json['addresses'].forEach((v) { addresses!.add(new Addresses.fromJson(v)); }); } createdAt = json['createdAt']; location = json['location'] != null ? new Location.fromJson(json['location']) : null; updatedAt = json['updatedAt']; userType = json['userType']; verification = json['verification'] != null ? new Verification.fromJson(json['verification']) : null; email = json['email']; gender = json['gender']; name = json['name']; profileImageUrl = json['profileImageUrl']; vehicleType = json['vehicleType']; }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['_id'] = this.sId; data['phoneNumber'] = this.phoneNumber; data['__v'] = this.iV; data['accountStatus'] = this.accountStatus; data['accountType'] = this.accountType; if (this.addresses != null) { data['addresses'] = this.addresses!.map((v) => v.toJson()).toList(); } data['createdAt'] = this.createdAt; if (this.location != null) { data['location'] = this.location!.toJson(); } data['updatedAt'] = this.updatedAt; data['userType'] = this.userType; if (this.verification != null) { data['verification'] = this.verification!.toJson(); } data['email'] = this.email; data['gender'] = this.gender; data['name'] = this.name; data['profileImageUrl'] = this.profileImageUrl; data['vehicleType'] = this.vehicleType; return data; } }

    class Addresses { String? name; Location? location; String? type; String? address; String? landMark; String? sId;

    Addresses( {this.name, this.location, this.type, this.address, this.landMark, this.sId});

    Addresses.fromJson(Map<String, dynamic> json) { name = json['name']; location = json['location'] != null ? new Location.fromJson(json['location']) : null; type = json['type']; address = json['address']; landMark = json['landMark']; sId = json['_id']; }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['name'] = this.name; if (this.location != null) { data['location'] = this.location!.toJson(); } data['type'] = this.type; data['address'] = this.address; data['landMark'] = this.landMark; data['_id'] = this.sId; return data; } }

    class Location { String? type; List? coordinates;

    Location({this.type, this.coordinates});

    Location.fromJson(Map<String, dynamic> json) { type = json['type']; coordinates = json['coordinates'].cast(); }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['type'] = this.type; data['coordinates'] = this.coordinates; return data; } }

    class Verification { Phone? phone; Aadhar? aadhar; BankDetails? bankDetails; Aadhar? drivingLicense; Aadhar? pancard; VehicleNumber? vehicleNumber; Aadhar? vehicleRC;

    Verification( {this.phone, this.aadhar, this.bankDetails, this.drivingLicense, this.pancard, this.vehicleNumber, this.vehicleRC});

    Verification.fromJson(Map<String, dynamic> json) { phone = json['phone'] != null ? new Phone.fromJson(json['phone']) : null; aadhar = json['aadhar'] != null ? new Aadhar.fromJson(json['aadhar']) : null; bankDetails = json['bankDetails'] != null ? new BankDetails.fromJson(json['bankDetails']) : null; drivingLicense = json['drivingLicense'] != null ? new Aadhar.fromJson(json['drivingLicense']) : null; pancard = json['pancard'] != null ? new Aadhar.fromJson(json['pancard']) : null; vehicleNumber = json['vehicleNumber'] != null ? new VehicleNumber.fromJson(json['vehicleNumber']) : null; vehicleRC = json['vehicleRC'] != null ? new Aadhar.fromJson(json['vehicleRC']) : null; }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.phone != null) { data['phone'] = this.phone!.toJson(); } if (this.aadhar != null) { data['aadhar'] = this.aadhar!.toJson(); } if (this.bankDetails != null) { data['bankDetails'] = this.bankDetails!.toJson(); } if (this.drivingLicense != null) { data['drivingLicense'] = this.drivingLicense!.toJson(); } if (this.pancard != null) { data['pancard'] = this.pancard!.toJson(); } if (this.vehicleNumber != null) { data['vehicleNumber'] = this.vehicleNumber!.toJson(); } if (this.vehicleRC != null) { data['vehicleRC'] = this.vehicleRC!.toJson(); } return data; } }

    class Phone { bool? isVerified; Otp? otp;

    Phone({this.isVerified, this.otp});

    Phone.fromJson(Map<String, dynamic> json) { isVerified = json['isVerified']; otp = json['otp'] != null ? new Otp.fromJson(json['otp']) : null; }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['isVerified'] = this.isVerified; if (this.otp != null) { data['otp'] = this.otp!.toJson(); } return data; } }

    class Otp { String? expiresAt; bool? isOtpSent; String? sentAt; int? value;

    Otp({this.expiresAt, this.isOtpSent, this.sentAt, this.value});

    Otp.fromJson(Map<String, dynamic> json) { expiresAt = json['ExpiresAt']; isOtpSent = json['isOtpSent']; sentAt = json['sentAt']; value = json['value']; }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['ExpiresAt'] = this.expiresAt; data['isOtpSent'] = this.isOtpSent; data['sentAt'] = this.sentAt; data['value'] = this.value; return data; } }

    class Aadhar { String? url; String? value;

    Aadhar({this.url, this.value});

    Aadhar.fromJson(Map<String, dynamic> json) { url = json['url']; value = json['value']; }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['url'] = this.url; data['value'] = this.value; return data; } }

    class BankDetails { String? bankIFSC; String? bankName; String? url; String? value;

    BankDetails({this.bankIFSC, this.bankName, this.url, this.value});

    BankDetails.fromJson(Map<String, dynamic> json) { bankIFSC = json['bankIFSC']; bankName = json['bankName']; url = json['url']; value = json['value']; }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['bankIFSC'] = this.bankIFSC; data['bankName'] = this.bankName; data['url'] = this.url; data['value'] = this.value; return data; } }

    class VehicleNumber { String? value;

    VehicleNumber({this.value});

    VehicleNumber.fromJson(Map<String, dynamic> json) { value = json['value']; }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['value'] = this.value; return data; } } `

    opened by Sanjay0907 0
  • Code generate missing class

    Code generate missing class

    Json: { "data": { "PersonInfo": { "name": "Eric" }, "PersonInfoList": [ { "name": "Eric" } ] } }

    Output: class GQLResponse { Data data;

    GQLResponse({this.data});

    GQLResponse.fromJson(Map<String, dynamic> json) { data = json['data'] != null ? new Data.fromJson(json['data']) : null; }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.data != null) { data['data'] = this.data.toJson(); } return data; } }

    class Data { PersonInfo personInfo; List personInfoList;

    Data({this.personInfo, this.personInfoList});

    Data.fromJson(Map<String, dynamic> json) { personInfo = json['PersonInfo'] != null ? new PersonInfo.fromJson(json['PersonInfo']) : null; if (json['PersonInfoList'] != null) { personInfoList = new List(); json['PersonInfoList'].forEach((v) { personInfoList.add(new PersonInfoList.fromJson(v)); }); } }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.personInfo != null) { data['PersonInfo'] = this.personInfo.toJson(); } if (this.personInfoList != null) { data['PersonInfoList'] = this.personInfoList.map((v) => v.toJson()).toList(); } return data; } }

    class PersonInfo { String name;

    PersonInfo({this.name});

    PersonInfo.fromJson(Map<String, dynamic> json) { name = json['name']; }

    Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['name'] = this.name; return data; } }

    The class PersonInfoList is missing but used in generated code, thanks if you can fix this.

    opened by 1774575836 0
  • Model Issue

    Model Issue

    When i copy model from your website it will not modify all data of json there are some parameters and class which can not be generated please check and support.

    opened by Androidvinod 1
Zooper flutter encoding utf16 - Helper classes to encode and decode UTF16 string to List

zooper_flutter_encoding_utf16 Helper classes to encode and decode UTF16 string t

Zooper 0 Feb 10, 2022
🎯 This library automatically generates object classes from JSON files that can be parsed by the freezed library.

The Most Powerful Way to Automatically Generate Model Objects from JSON Files ⚡ 1. Guide ?? 1.1. Features ?? 1.1.1. From 1.1.2. To 1.2. Getting Starte

KATO, Shinya / 加藤 真也 14 Nov 9, 2022
A JSON serialize class to convert 'to' and 'from' JSON format Enums, DateTime and any of your own classes.

A JSON serialize class to convert 'to' and 'from' JSON format Enums, DateTime and any of your own classes. Introduction Jsonize solves the problem of

null 2 Nov 17, 2022
A basic template of Flutter to get started. Includes various folders and packages that might be necessary.

Flutter App - Basic Template It's a time saving template with basic project structure, packages and other files like constants.dart to get started rat

Muhammad Hamza 47 Jun 12, 2022
A basic template of Flutter to get started. Includes various folders and packages that might be necessary.

Flutter App - Basic Template It's a time saving template with basic project structure, packages and other files like constants.dart to get started rat

Muhammad Hamza 47 Jun 12, 2022
A generator for fhir dart classes with json artifacts.

A generator for fhir dart classes with json artifacts. Thie generator uses the freezed package to generate the data classes. It also uses all the primitive_types from the fhir package.

Joel Staubach 2 Jun 14, 2022
This is a Flutter plugin that takes a JSON string and converts it onto a customizable Flutter Widget.

Colored JSON Convert JSON string into customizable widget. Getting Started ColoredJson is a stateless widget that produces a structured view of JSON s

null 4 May 20, 2022
A dart library to check if given point(s) are present inside polygon or not.

poly A library for checking if given point(s) is present inside Polygon or not. Contents Installation Examples Note: Instead of casting, use toListNum

Sacchi 9 Feb 25, 2022
The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs!

SwiftGen SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them ty

null 8.3k Dec 31, 2022
Flutter shareable package of object-oriented classes for local caching of user data in json

json_cache Json Cache is an object-oriented package to serve as a layer on top of local storage packages - packages that persist data locally on the u

Dartoos 10 Dec 19, 2022
Flutter-sorted-chips-row - Flutter library for rendering a row of Material "Chip" buttons that gets sorted according to the given function

sorted_chips_row A Flutter Widget displaying a row of Material Chips, sorted according to the provided comparison function. How to use Adding dependen

Callstack Incubator 29 Jul 29, 2021
Simple Dart package with build-in code generation. It simplifies and speedup creation of cache mechanism for dart classes.

Simple Dart package with build-in code generation. It simplifies and speedup creation of cache mechanism for dart classes.

iteo 37 Jan 2, 2023
Tool made in Dart that allows you to dynamically generate JSON files from data models written in Dart.

Dart JSON Generator Versión v1.1.1 Dart JSON Generator es una herramienta que permite generar archivos JSON a partir de mapas como modelos de datos en

Joinner Medina 7 Nov 23, 2022
State Persistence - Persist state across app launches. By default this library store state as a local JSON file called `data.json` in the applications data directory. Maintainer: @slightfoot

State Persistence Persist state across app launches. By default this library store state as a local JSON file called data.json in the applications dat

Flutter Community 70 Sep 28, 2022
A Dart package that constantly writes a string to an IOSink, simillarly to the UNIX yes utility.

yes A Dart package that constantly writes a string to an IOSink, simillarly to the UNIX yes utility. Usage // Write to stdout for 5 seconds. final con

null 0 Sep 22, 2022
Simple, random string generator for Dart

Simple Random String Simple, random string generator Features Lower characters Upper characters Numbers Customizable special characters Repeatable or

Yasin TUNCEL 1 Dec 19, 2022
Imports resource files as string or binary literals in Dart code.

resource_importer Imports resource files as string or binary literals in Dart code. What? resource_importer probably is best described with an example

James D. Lin 0 Dec 3, 2022
A group of overlapping round avatars are called face piles, a face pile is a series of overlapping avatar images that come and go as users join and leave a given group.

Flutter Face Pile A group of overlapping round avatars are called face piles. A face pile is a series of overlapping avatar images that come and go as

Amine Chamkh 3 Sep 22, 2022
Create dart data classes easily, fast and without writing boilerplate or running code generation.

Dart Data Class Generator Create dart data classes easily, fast and without writing boilerplate or running code generation. Features The generator can

null 186 Feb 28, 2022