问:
The method '[]' was called on null. Receiver: null
To isolate the issue,  I created a new code, a new program, and a new machine.
Same results, it just doesn't want to print any value that has  is after  "quotes and has "anythingPrice"

Again I can give you a temp key and you can fully run the code. on your side.

Please let me know.

```<code>import 'dart:async';
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
//import 'package:flutter_web/material.dart';
//import 'package:flutter/main.dart' as app;
//import 'package:flutter_web_ui/ui.dart' as ui;

Future<List<Photo>> fetchPhotos(http.Client client) async {
  final response =
 // await client.get('https://cloud.iexapis.com/stable/stock/market/batch?symbols=CNPF,ICOL,PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,IEI,TLH,DIA,BSJF,MONY&types=quote,stats&token=');

  await client.get('https://cloud.iexapis.com/stable/stock/market/batch?symbols=PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,PGF,SNLN,DVHL,AUNZ,MDIV,PHB,PFXF,FPE,TIPX,MLN,SDIV,SIPE,SEMF,EMAG,IEMF,EU,BSCM,LEMF,BSCL,BSCK,BSCJ,BSCI,DSUM,BSCF,KBWD,PCEF,BSCG,BSCH,HYEM,ITM,BKLN,PGHY,IBCE,PZT,IJNK,XMPT,THHY,QYLD,IHY,IYLD,SHYD,PRB,DVHI,GOVT,BSJJ,BSJK,RIGS,INY,IBCD,PZA,PFIG,IBCC,BSCE,PVI,MBG,CXA,FWDB,DIV,CHLC,BSJI,FLTR,PWZ,MUAH,IBDD,PICB,IBDB,BSJH,RVNU,BSJG,IBDC,XOVR,BSJE,EBND,PCY,BWX,SJNK,DES,ANGL,BAB,SST,EMCD,CBND,HYD,PLW,SCPB,FLRN,BWZ,KBWY,ELD,IBND,AOK,RWXL,ITR,DON,DGRS,JNK,TZD,EPU,PFF,HYLD,GGOV,ULST,SPHD,HFIN,DGRW,LWC,ALD,LEMB,AGND,ITIP,EMHY,QLTC,TFI,SRLN,HYLS,SHM,GNMA,CEMB,IGOV,MINC,AGZD,FTSL,SPLV,GHYG,ISTB,ENGN,CMBS,GTIP,SCHO,SMMU,QLTA,SCHZ,HSPX,TUZ,GIY,GSY,TFLO,VMBS,CWB,FLOT,STPZ,MUAC,SCHR,BABZ,HYXU,GMTB,MUNI,WIP,MUAD,QLTB,SCHP,GMMB,MUAE,IPE,NYF,BNDX,MUAF,HYMB,TIPZ,CMF,LAG,ILTB,ITE,CLY,VGSH,VGIT,LTPZ,BABS,HYHG,EMCB,DVYL,VGLT,DHS,TLO,VWOB,IGHG,GLCB,RAVI,VCSH,BSV,BND,BIV,ISHG,SDYL,VCIT,SHY,BLV,HYG,VCLT,TENZ,DTN,BIL,AUD,DLN,DTD,FTSD,CAD,STIP,CORP,HYS,HOLD,TRSY,IEF,IBDA,COBO,BOND,MINT,MBB,CSJ,AGG,SUB,EMB,CIU,GVI,MUB,GBF,TIP,AGZ,CFT,LQD,TLT,IEI,TLH,DIA,BSJF,MONY&types=stats,quote&token=');
  //https://cloud.iexapis.com/v1/stock/market/batch?&types=price&symbols=aapl,fb,tsla&token=YOUR_TOKEN_HERE
  //https://cloud.iexapis.com/v1/stock/market/batch?&types=quote&symbols=aapl,fb,tsla&token=
  // Use the compute function to run parsePhotos in a separate isolate.
  //https://cloud.iexapis.com/stable/stock/market/batch?symbols=CNPF,ICOL,PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,PGF,SNLN,DVHL,AUNZ,MDIV,PHB,PFXF,FPE,TIPX,MLN,SDIV,SIPE,SEMF,EMAG,IEMF,EU,BSCM,LEMF,BSCL,BSCK,BSCJ,BSCI,DSUM,BSCF,KBWD,PCEF,BSCG,BSCH,HYEM,ITM,BKLN,PGHY,IBCE,PZT,IJNK,XMPT,THHY,QYLD,IHY,IYLD,SHYD,PRB,DVHI,GOVT,BSJJ,BSJK,RIGS,INY,IBCD,PZA,PFIG,IBCC,BSCE,PVI,MBG,CXA,FWDB,DIV,CHLC,BSJI,FLTR,PWZ,MUAH,IBDD,PICB,IBDB,BSJH,RVNU,BSJG,IBDC,XOVR,BSJE,EBND,PCY,BWX,SJNK,DES,ANGL,BAB,SST,EMCD,CBND,HYD,PLW,SCPB,FLRN,BWZ,KBWY,ELD,IBND,AOK,RWXL,ITR,DON,DGRS,JNK,TZD,EPU,PFF,HYLD,GGOV,ULST,SPHD,HFIN,DGRW,LWC,ALD,LEMB,AGND,ITIP,EMHY,QLTC,TFI,SRLN,HYLS,SHM,GNMA,CEMB,IGOV,MINC,AGZD,FTSL,SPLV,GHYG,ISTB,ENGN,CMBS,GTIP,SCHO,SMMU,QLTA,SCHZ,HSPX,TUZ,GIY,GSY,TFLO,VMBS,CWB,FLOT,STPZ,MUAC,SCHR,BABZ,HYXU,GMTB,MUNI,WIP,MUAD,QLTB,SCHP,GMMB,MUAE,IPE,NYF,BNDX,MUAF,HYMB,TIPZ,CMF,LAG,ILTB,ITE,CLY,VGSH,VGIT,LTPZ,BABS,HYHG,EMCB,DVYL,VGLT,DHS,TLO,VWOB,IGHG,GLCB,RAVI,VCSH,BSV,BND,BIV,ISHG,SDYL,VCIT,SHY,BLV,HYG,VCLT,TENZ,DTN,BIL,AUD,DLN,DTD,FTSD,CAD,STIP,CORP,HYS,HOLD,TRSY,IEF,IBDA,COBO,BOND,MINT,MBB,CSJ,AGG,SUB,EMB,CIU,GVI,MUB,GBF,TIP,AGZ,CFT,LQD,TLT,IEI,TLH,DIA,BSJF,MONY&types=quote,stats&token=
  return compute(parsePhotos, response.body);
}

// A function that converts a response body into a List<Photo>.
List<Photo> parsePhotos(String responseBody) {
  //final parsed = json.decode(responseBody).cast<Map<String,dynamic>>();

  //return parsed.map<Photo>((json) => Photo.fromJson(json)).toList();

  dynamic Obj = json.decode(responseBody);
  debugPrint(responseBody, wrapWidth: 8192);
  print(Obj.length);

  List<Photo> photoList = [];
  Obj.forEach((k, v) => photoList.add(Photo(k,v)));

  return photoList;
}

class Photo {
  String symbol;
  //String companyName;
  dynamic data;
 // dynamic iexClose;
 // dynamic quote;
  Photo(this.symbol ,this.data);

}

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override

  Widget build(BuildContext context) {

    final appTitle = 'Monthly Paying ETFs';

    return MaterialApp(
      title: appTitle,
      home: MyHomePage(title: appTitle),

    );
  }
}

class MyHomePage extends StatelessWidget {

  final String title;

  MyHomePage({Key key, this.title}) : super(key: key);

  @override
  Widget build(BuildContext context) {

    return Scaffold(

        drawer: Drawer(
          // Add a ListView to the drawer. This ensures the user can scroll
          // through the options in the drawer if there isn't enough vertical
          // space to fit everything.
          child: ListView(
            // Important: Remove any padding from the ListView.
            padding: EdgeInsets.zero,
            children: <Widget>[
              DrawerHeader(
                child: Text('About'),
                decoration: BoxDecoration(
                  color: Colors.grey,
                ),
              ),
              ListTile(
                title: Text('This app is to provide the list of ETF s that pay monthly dividend'),

                onTap: () {
                  // Update the state of the app
                  // ...
                  // Then close the drawer
                  Navigator.pop(context);
                },

              ),
              ListTile(
                title: Text('for questions or feedback please contact me at  '),

                onTap: () {
                  // Update the state of the app
                  // ...
                  // Then close the drawer
                  Navigator.pop(context);
                },

              ),

            ],
          ),
        ),

        appBar: AppBar(
        title: Text(title),
          backgroundColor: Colors.greenAccent,
      ),

      body: FutureBuilder<List<Photo>>(

        future: fetchPhotos(http.Client()),

        builder: (context, snapshot) {
          if (snapshot.hasError) print(snapshot.error);

          return snapshot.hasData
              ? PhotosList(photos: snapshot.data)
              : Center(child: CircularProgressIndicator());

        },
      ),
    );
  }
}

class PhotosList extends StatefulWidget {
  final List photos;

  PhotosList({Key key, this.photos})
      : assert(photos != null),
        super(key: key);

  @override
  _PhotosListState createState() => _PhotosListState();
}

class _PhotosListState extends State<PhotosList> {
  @override

  Widget build(BuildContext context) {

    return bodyData();

  }

  SingleChildScrollView bodyData() =>

    SingleChildScrollView(
  scrollDirection: Axis.vertical,

      // padding: EdgeInsets.all(0.0),
       //padding: const EdgeInsets.symmetric(
       //  padding: new EdgeInsets.fromLTRB(0.001, .001, 1.0, 1.0),
       padding: EdgeInsets.all(0.05),

 // child: FittedBox(fit:BoxFit.contain,

  child:SingleChildScrollView(
    scrollDirection: Axis.horizontal,

  child:
  FittedBox(
  fit: BoxFit.fitHeight,
  child: DataTable(
         // sortColumnIndex: 1,
        //  sortAscending: true,

          columns: <DataColumn>[
            DataColumn(
              label: Text("Company"),
              onSort: (_, __) {
                setState(() {
                  widget.photos.sort((a, b) =>
                      a.data["quote"]["companyName"]
                          .compareTo(b.data["quote"]["companyName"]));
                });
              },
            ),

            DataColumn(
              label: Text("ttmDivRate"),
              numeric: true,
              onSort:   (_,__) {
                setState(() {
                  widget.photos.sort((a, b) =>
                      a.data["quote"]["ttmDividendRate"]
                          .compareTo(b.data["quote"]["ttmDividendRate"]));
                });
              },
            ),

            DataColumn(
              label: Text("Price"),
              numeric: true,
              onSort: (_, __) {
                setState(() {
                  widget.photos.sort((a, b) => a.data ["quote"]["latestPrice"]
                      .compareTo(b.data["quote"]["latestPrice"]));
                });
              },
            ),

          ],

          rows: widget.photos

              .map(
                (photo) =>

                DataRow(
                  cells: [

                    DataCell(
                      Text('${photo.data["stats"]["companyName"] ?? ""}'),
                    ),

                    DataCell(
                      Text('${photo.data["stats"]["ttmDividendRate"] ?? ""}'),
                   ),
//["quote"]["stats"]
                    DataCell(
                      Text('${photo.data["quote"]["stats"]["latestPrice"] ?? ""}')
                    ),

                  ],
                ),

          )

              .toList())

),
   ),

    );

}

</code>```

The issue is that values are there and Flutter says is null when the output is in the console.

```<code>===================
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running Xcode build...
Xcode build done.                                           17.9s
Waiting for iPhone 11 Pro Max to report its views...
Debug service listening on ws://127.0.0.1:57768/yyPV-GQyldg=/ws
Syncing files to device iPhone 11 Pro Max...
flutter: {"PGX":{"stats":{"week52change":-0.025465,"week52high":15.28,"week52low":9.71,"marketcap":4595628000,"employees":null,"day200MovingAvg":14.55,"day50MovingAvg":13.39,"float":null,"avg10Volume":2336007.5,"avg30Volume":2648722.77,"ttmEPS":null,"ttmDividendRate":0.8361,"companyName":"Invesco Preferred ETF","sharesOutstanding":324550000,"maxChangePercent":-0.3042,"year5ChangePercent":-0.0367,"year2ChangePercent":-0.0167,"year1ChangePercent":-0.025465,"ytdChangePercent":-0.064111,"month6ChangePercent":-0.045822,"month3ChangePercent":-0.052209,"month1ChangePercent":0.019438,"day30ChangePercent":0.028322,"day5ChangePercent":0.015054,"nextDividendDate":"2020-05-18","dividendYield":0.059046610169491524,"nextEarningsDate":null,"exDividendDate":"2020-05-18","peRatio":null,"beta":0.5684535732534528},"quote":{"symbol":"PGX","companyName":"Invesco Preferred ETF","primaryExchange":"NYSE Arca","calculationPrice":"close","open":14.11,"openTime":1590154200191,"openSource":"official","close":14.16,"closeT<…>
flutter: 2020","latestUpdate":1590177600180,"latestVolume":4747,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":11.245,"delayedPriceTime":1590192000004,"oddLotDelayedPrice":11.193,"oddLotDelayedPriceTime":1590173727614,"extendedPrice":11.245,"extendedChange":0.005,"extendedChangePercent":0.00044,"extendedPriceTime":1590186600005,"previousClose":11.16,"previousVolume":8688,"change":0.08,"changePercent":0.00717,"volume":4747,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":12262,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"iexOpen":null,"iexOpenTime":null,"iexClose":11.04,"iexCloseTime":1589988569572,"marketCap":35406000,"peRatio":null,"week52High":16.6,"week52Low":8.47,"ytdChange":-0.300712,"lastTradeTime":1590177600181,"isUSMarketOpen":false}},"IPFF":{"stats":{"week52change":-0.23383400000000001,"week52high":15.71,"week52low":8.38,"marketcap":28738500,"employees":null,"day200MovingAvg":13.89,"day50MovingAvg":10.96,"float<…>
flutter: 95
flutter: {"PGX":{"stats":{"week52change":-0.025465,"week52high":15.28,"week52low":9.71,"marketcap":4595628000,"employees":null,"day200MovingAvg":14.55,"day50MovingAvg":13.39,"float":null,"avg10Volume":2336007.5,"avg30Volume":2648722.77,"ttmEPS":null,"ttmDividendRate":0.8361,"companyName":"Invesco Preferred ETF","sharesOutstanding":324550000,"maxChangePercent":-0.3042,"year5ChangePercent":-0.0367,"year2ChangePercent":-0.0167,"year1ChangePercent":-0.025465,"ytdChangePercent":-0.064111,"month6ChangePercent":-0.045822,"month3ChangePercent":-0.052209,"month1ChangePercent":0.019438,"day30ChangePercent":0.028322,"day5ChangePercent":0.015054,"nextDividendDate":"2020-05-18","dividendYield":0.059046610169491524,"nextEarningsDate":null,"exDividendDate":"2020-05-18","peRatio":null,"beta":0.5684535732534528},"**quote":{"symbol":"PGX","companyName":"Invesco Preferred ETF","primaryExchange":"NYSE Arca","calculationPrice":"close","open":14.11,"openTime":1590154200191,"openSource":"official","close":14.16,"closeT<…>
flutter: 2020","latestUpdate":1590177600180,"latestVolume":4747,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":11.245,"delayedPriceTime":1590192000004,"oddLotDelayedPrice":11.193,"oddLotDelayedPriceTime":1590173727614,"extendedPrice":11.245,"extendedChange":0.005,"extendedChangePercent":0.00044,"extendedPriceTime":1590186600005,"previousClose":11.16,"previousVolume":8688,"change":0.08,"changePercent":0.00717,"volume":4747,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":12262,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"iexOpen":null,"iexOpenTime":null,"iexClose":11.04,"iexCloseTime":1589988569572,"marketCap":35406000,"peRatio":null,"week52High":16.6,"week52Low":8.47,"ytdChange":-0.300712,"lastTradeTime":1590177600181,"isUSMarketOpen":false}},"IPFF":{"stats":{"week52change":-0.23383400000000001,"week52high":15.71,"week52low":8.38,"marketcap":28738500,"employees":null,"day200MovingAvg":13.89,"day50MovingAvg":10.96,"float<…>
flutter: 95**

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following NoSuchMethodError was thrown building photorealist(dirty, state: _PhotosListState#8eef8):
The method '[]' was called on null.
Receiver: null
Tried calling: []("iexClose")
</code>```

=============
Column Price is empty.
If I try to call  "delayedPrice":11.552," or "iexClose":11.04. it does not print in the app.

答:
In the response, for some companies (or symbol) the quote value is null.

Example(IEMF, EU, etc):

```<code>     "IEMF": {
          "stats": {
               "symbol": "IEMF",
               "nextDividendDate": null,
               "nextEarningsDate": null,
               "exDividendDate": null,
               "peRatio": null,
               "beta": null
          },
          "quote": null
     },
     "EU": {
          "stats": {
               "symbol": "EU",
               "nextDividendDate": null,
               "nextEarningsDate": null,
               "exDividendDate": null,
               "peRatio": null,
               "beta": null
          },
          "quote": null
     },
</code>```

Check:

photo.data["quote"] != null

And there is no stats inside quote. so don't call photo.data["quote"]["stats"]

Instead of Text('${photo.data["quote"]["stats"]["latestPrice"] ?? ""}'), use Text('${(photo.data["quote"] != null ? photo.data["quote"]["latestPrice"] : "") ?? ""}')

Full Code:

```<code>import 'dart:async';
import 'dart:convert';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;

//import 'package:flutter_web/material.dart';
//import 'package:flutter/main.dart' as app;
//import 'package:flutter_web_ui/ui.dart' as ui;

Future<List<Photo>> fetchPhotos(http.Client client) async {
  final response =
      // await client.get('https://cloud.iexapis.com/stable/stock/market/batch?symbols=CNPF,ICOL,PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,IEI,TLH,DIA,BSJF,MONY&types=quote,stats&token=');
      await client.get(
    'https://cloud.iexapis.com/stable/stock/market/batch?symbols=PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,PGF,SNLN,DVHL,AUNZ,MDIV,PHB,PFXF,FPE,TIPX,MLN,SDIV,SIPE,SEMF,EMAG,IEMF,EU,BSCM,LEMF,BSCL,BSCK,BSCJ,BSCI,DSUM,BSCF,KBWD,PCEF,BSCG,BSCH,HYEM,ITM,BKLN,PGHY,IBCE,PZT,IJNK,XMPT,THHY,QYLD,IHY,IYLD,SHYD,PRB,DVHI,GOVT,BSJJ,BSJK,RIGS,INY,IBCD,PZA,PFIG,IBCC,BSCE,PVI,MBG,CXA,FWDB,DIV,CHLC,BSJI,FLTR,PWZ,MUAH,IBDD,PICB,IBDB,BSJH,RVNU,BSJG,IBDC,XOVR,BSJE,EBND,PCY,BWX,SJNK,DES,ANGL,BAB,SST,EMCD,CBND,HYD,PLW,SCPB,FLRN,BWZ,KBWY,ELD,IBND,AOK,RWXL,ITR,DON,DGRS,JNK,TZD,EPU,PFF,HYLD,GGOV,ULST,SPHD,HFIN,DGRW,LWC,ALD,LEMB,AGND,ITIP,EMHY,QLTC,TFI,SRLN,HYLS,SHM,GNMA,CEMB,IGOV,MINC,AGZD,FTSL,SPLV,GHYG,ISTB,ENGN,CMBS,GTIP,SCHO,SMMU,QLTA,SCHZ,HSPX,TUZ,GIY,GSY,TFLO,VMBS,CWB,FLOT,STPZ,MUAC,SCHR,BABZ,HYXU,GMTB,MUNI,WIP,MUAD,QLTB,SCHP,GMMB,MUAE,IPE,NYF,BNDX,MUAF,HYMB,TIPZ,CMF,LAG,ILTB,ITE,CLY,VGSH,VGIT,LTPZ,BABS,HYHG,EMCB,DVYL,VGLT,DHS,TLO,VWOB,IGHG,GLCB,RAVI,VCSH,BSV,BND,BIV,ISHG,SDYL,VCIT,SHY,BLV,HYG,VCLT,TENZ,DTN,BIL,AUD,DLN,DTD,FTSD,CAD,STIP,CORP,HYS,HOLD,TRSY,IEF,IBDA,COBO,BOND,MINT,MBB,CSJ,AGG,SUB,EMB,CIU,GVI,MUB,GBF,TIP,AGZ,CFT,LQD,TLT,IEI,TLH,DIA,BSJF,MONY&types=stats,quote&token=pk_fd71da12cae34ae9abdf3df4958302fe',
  );
  //https://cloud.iexapis.com/v1/stock/market/batch?&types=price&symbols=aapl,fb,tsla&token=YOUR_TOKEN_HERE
  //https://cloud.iexapis.com/v1/stock/market/batch?&types=quote&symbols=aapl,fb,tsla&token=
  // Use the compute function to run parsePhotos in a separate isolate.
  //https://cloud.iexapis.com/stable/stock/market/batch?symbols=CNPF,ICOL,PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,PGF,SNLN,DVHL,AUNZ,MDIV,PHB,PFXF,FPE,TIPX,MLN,SDIV,SIPE,SEMF,EMAG,IEMF,EU,BSCM,LEMF,BSCL,BSCK,BSCJ,BSCI,DSUM,BSCF,KBWD,PCEF,BSCG,BSCH,HYEM,ITM,BKLN,PGHY,IBCE,PZT,IJNK,XMPT,THHY,QYLD,IHY,IYLD,SHYD,PRB,DVHI,GOVT,BSJJ,BSJK,RIGS,INY,IBCD,PZA,PFIG,IBCC,BSCE,PVI,MBG,CXA,FWDB,DIV,CHLC,BSJI,FLTR,PWZ,MUAH,IBDD,PICB,IBDB,BSJH,RVNU,BSJG,IBDC,XOVR,BSJE,EBND,PCY,BWX,SJNK,DES,ANGL,BAB,SST,EMCD,CBND,HYD,PLW,SCPB,FLRN,BWZ,KBWY,ELD,IBND,AOK,RWXL,ITR,DON,DGRS,JNK,TZD,EPU,PFF,HYLD,GGOV,ULST,SPHD,HFIN,DGRW,LWC,ALD,LEMB,AGND,ITIP,EMHY,QLTC,TFI,SRLN,HYLS,SHM,GNMA,CEMB,IGOV,MINC,AGZD,FTSL,SPLV,GHYG,ISTB,ENGN,CMBS,GTIP,SCHO,SMMU,QLTA,SCHZ,HSPX,TUZ,GIY,GSY,TFLO,VMBS,CWB,FLOT,STPZ,MUAC,SCHR,BABZ,HYXU,GMTB,MUNI,WIP,MUAD,QLTB,SCHP,GMMB,MUAE,IPE,NYF,BNDX,MUAF,HYMB,TIPZ,CMF,LAG,ILTB,ITE,CLY,VGSH,VGIT,LTPZ,BABS,HYHG,EMCB,DVYL,VGLT,DHS,TLO,VWOB,IGHG,GLCB,RAVI,VCSH,BSV,BND,BIV,ISHG,SDYL,VCIT,SHY,BLV,HYG,VCLT,TENZ,DTN,BIL,AUD,DLN,DTD,FTSD,CAD,STIP,CORP,HYS,HOLD,TRSY,IEF,IBDA,COBO,BOND,MINT,MBB,CSJ,AGG,SUB,EMB,CIU,GVI,MUB,GBF,TIP,AGZ,CFT,LQD,TLT,IEI,TLH,DIA,BSJF,MONY&types=quote,stats&token=
  return compute(parsePhotos, response.body);
}

// A function that converts a response body into a List<Photo>.
List<Photo> parsePhotos(String responseBody) {
  //final parsed = json.decode(responseBody).cast<Map<String,dynamic>>();

  //return parsed.map<Photo>((json) => Photo.fromJson(json)).toList();

  dynamic obj = json.decode(responseBody);
  debugPrint(responseBody, wrapWidth: 1000);
  print(obj.length);

  List<Photo> photoList = [];
  obj.forEach((k, v) => photoList.add(Photo(k, v)));

  return photoList;
}

class Photo {
  String symbol;

  //String companyName;
  dynamic data;

  // dynamic iexClose;
  // dynamic quote;
  Photo(this.symbol, this.data);
}

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final appTitle = 'Monthly Paying ETFs';

    return MaterialApp(
      title: appTitle,
      home: MyHomePage(title: appTitle),
    );
  }
}

class MyHomePage extends StatelessWidget {
  final String title;

  MyHomePage({Key key, this.title}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      drawer: Drawer(
        // Add a ListView to the drawer. This ensures the user can scroll
        // through the options in the drawer if there isn't enough vertical
        // space to fit everything.
        child: ListView(
          // Important: Remove any padding from the ListView.
          padding: EdgeInsets.zero,
          children: <Widget>[
            DrawerHeader(
              child: Text('About'),
              decoration: BoxDecoration(
                color: Colors.grey,
              ),
            ),
            ListTile(
              title: Text(
                'This app is to provide the list of ETF s that pay monthly dividend',
              ),
              onTap: () {
                // Update the state of the app
                // ...
                // Then close the drawer
                Navigator.pop(context);
              },
            ),
            ListTile(
              title: Text(
                'for questions or feedback please contact me at  ',
              ),
              onTap: () {
                // Update the state of the app
                // ...
                // Then close the drawer
                Navigator.pop(context);
              },
            ),
          ],
        ),
      ),
      appBar: AppBar(
        title: Text(title),
        backgroundColor: Colors.greenAccent,
      ),
      body: FutureBuilder<List<Photo>>(
        future: fetchPhotos(http.Client()),
        builder: (context, snapshot) {
          if (snapshot.hasError) print(snapshot.error);

          return snapshot.hasData
              ? PhotosList(photos: snapshot.data)
              : Center(
                  child: CircularProgressIndicator(),
                );
        },
      ),
    );
  }
}

class PhotosList extends StatefulWidget {
  final List photos;

  PhotosList({Key key, this.photos})
      : assert(photos != null),
        super(key: key);

  @override
  _PhotosListState createState() => _PhotosListState();
}

class _PhotosListState extends State<PhotosList> {
  @override
  Widget build(BuildContext context) {
    return bodyData();
  }

  SingleChildScrollView bodyData() => SingleChildScrollView(
        scrollDirection: Axis.vertical,

        // padding: EdgeInsets.all(0.0),
        //padding: const EdgeInsets.symmetric(
        //  padding: new EdgeInsets.fromLTRB(0.001, .001, 1.0, 1.0),
        padding: EdgeInsets.all(0.05),

        // child: FittedBox(fit:BoxFit.contain,

        child: SingleChildScrollView(
          scrollDirection: Axis.horizontal,
          child: FittedBox(
            fit: BoxFit.fitHeight,
            child: DataTable(
              // sortColumnIndex: 1,
              //  sortAscending: true,

              columns: <DataColumn>[
                DataColumn(
                  label: Text("Company"),
                  onSort: (_, __) {
                    setState(() {
                      widget.photos.sort((a, b) => a.data["quote"]
                              ["companyName"]
                          .compareTo(b.data["quote"]["companyName"]));
                    });
                  },
                ),
                DataColumn(
                  label: Text("ttmDivRate"),
                  numeric: true,
                  onSort: (_, __) {
                    setState(() {
                      widget.photos.sort((a, b) => a.data["quote"]
                              ["ttmDividendRate"]
                          .compareTo(b.data["quote"]["ttmDividendRate"]));
                    });
                  },
                ),
                DataColumn(
                  label: Text("Price"),
                  numeric: true,
                  onSort: (_, __) {
                    setState(() {
                      widget.photos.sort((a, b) => a.data["quote"]
                              ["latestPrice"]
                          .compareTo(b.data["quote"]["latestPrice"]));
                    });
                  },
                ),
              ],
              rows: widget.photos
                  .map(
                    (photo) => DataRow(
                      cells: [
                        DataCell(
                          Text(
                            '${photo.data["stats"]["companyName"] ?? ""}',
                          ),
                        ),

                        DataCell(
                          Text(
                            '${photo.data["stats"]["ttmDividendRate"] ?? ""}',
                          ),
                        ),
//["quote"]["stats"]
                        DataCell(
                          Text(
                            '${(photo.data["quote"] != null ? photo.data["quote"]["latestPrice"] : "") ?? ""}',
                          ),
                        ),
                      ],
                    ),
                  )
                  .toList(),
            ),
          ),
        ),
      );
}
</code>```

Body:
To isolate the issue,  I created a new code, a new program, and a new machine.
Same results, it just doesn't want to print any value that has  is after  "quotes and has "anythingPrice"

Again I can give you a temp key and you can fully run the code. on your side.

Please let me know.

import 'dart:async';
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
//import 'package:flutter_web/material.dart';
//import 'package:flutter/main.dart' as app;
//import 'package:flutter_web_ui/ui.dart' as ui;

Future<List<Photo>> fetchPhotos(http.Client client) async {
  final response =
 // await client.get('https://cloud.iexapis.com/stable/stock/market/batch?symbols=CNPF,ICOL,PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,IEI,TLH,DIA,BSJF,MONY&types=quote,stats&token=');

  await client.get('https://cloud.iexapis.com/stable/stock/market/batch?symbols=PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,PGF,SNLN,DVHL,AUNZ,MDIV,PHB,PFXF,FPE,TIPX,MLN,SDIV,SIPE,SEMF,EMAG,IEMF,EU,BSCM,LEMF,BSCL,BSCK,BSCJ,BSCI,DSUM,BSCF,KBWD,PCEF,BSCG,BSCH,HYEM,ITM,BKLN,PGHY,IBCE,PZT,IJNK,XMPT,THHY,QYLD,IHY,IYLD,SHYD,PRB,DVHI,GOVT,BSJJ,BSJK,RIGS,INY,IBCD,PZA,PFIG,IBCC,BSCE,PVI,MBG,CXA,FWDB,DIV,CHLC,BSJI,FLTR,PWZ,MUAH,IBDD,PICB,IBDB,BSJH,RVNU,BSJG,IBDC,XOVR,BSJE,EBND,PCY,BWX,SJNK,DES,ANGL,BAB,SST,EMCD,CBND,HYD,PLW,SCPB,FLRN,BWZ,KBWY,ELD,IBND,AOK,RWXL,ITR,DON,DGRS,JNK,TZD,EPU,PFF,HYLD,GGOV,ULST,SPHD,HFIN,DGRW,LWC,ALD,LEMB,AGND,ITIP,EMHY,QLTC,TFI,SRLN,HYLS,SHM,GNMA,CEMB,IGOV,MINC,AGZD,FTSL,SPLV,GHYG,ISTB,ENGN,CMBS,GTIP,SCHO,SMMU,QLTA,SCHZ,HSPX,TUZ,GIY,GSY,TFLO,VMBS,CWB,FLOT,STPZ,MUAC,SCHR,BABZ,HYXU,GMTB,MUNI,WIP,MUAD,QLTB,SCHP,GMMB,MUAE,IPE,NYF,BNDX,MUAF,HYMB,TIPZ,CMF,LAG,ILTB,ITE,CLY,VGSH,VGIT,LTPZ,BABS,HYHG,EMCB,DVYL,VGLT,DHS,TLO,VWOB,IGHG,GLCB,RAVI,VCSH,BSV,BND,BIV,ISHG,SDYL,VCIT,SHY,BLV,HYG,VCLT,TENZ,DTN,BIL,AUD,DLN,DTD,FTSD,CAD,STIP,CORP,HYS,HOLD,TRSY,IEF,IBDA,COBO,BOND,MINT,MBB,CSJ,AGG,SUB,EMB,CIU,GVI,MUB,GBF,TIP,AGZ,CFT,LQD,TLT,IEI,TLH,DIA,BSJF,MONY&types=stats,quote&token=');
  //https://cloud.iexapis.com/v1/stock/market/batch?&types=price&symbols=aapl,fb,tsla&token=YOUR_TOKEN_HERE
  //https://cloud.iexapis.com/v1/stock/market/batch?&types=quote&symbols=aapl,fb,tsla&token=
  // Use the compute function to run parsePhotos in a separate isolate.
  //https://cloud.iexapis.com/stable/stock/market/batch?symbols=CNPF,ICOL,PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,PGF,SNLN,DVHL,AUNZ,MDIV,PHB,PFXF,FPE,TIPX,MLN,SDIV,SIPE,SEMF,EMAG,IEMF,EU,BSCM,LEMF,BSCL,BSCK,BSCJ,BSCI,DSUM,BSCF,KBWD,PCEF,BSCG,BSCH,HYEM,ITM,BKLN,PGHY,IBCE,PZT,IJNK,XMPT,THHY,QYLD,IHY,IYLD,SHYD,PRB,DVHI,GOVT,BSJJ,BSJK,RIGS,INY,IBCD,PZA,PFIG,IBCC,BSCE,PVI,MBG,CXA,FWDB,DIV,CHLC,BSJI,FLTR,PWZ,MUAH,IBDD,PICB,IBDB,BSJH,RVNU,BSJG,IBDC,XOVR,BSJE,EBND,PCY,BWX,SJNK,DES,ANGL,BAB,SST,EMCD,CBND,HYD,PLW,SCPB,FLRN,BWZ,KBWY,ELD,IBND,AOK,RWXL,ITR,DON,DGRS,JNK,TZD,EPU,PFF,HYLD,GGOV,ULST,SPHD,HFIN,DGRW,LWC,ALD,LEMB,AGND,ITIP,EMHY,QLTC,TFI,SRLN,HYLS,SHM,GNMA,CEMB,IGOV,MINC,AGZD,FTSL,SPLV,GHYG,ISTB,ENGN,CMBS,GTIP,SCHO,SMMU,QLTA,SCHZ,HSPX,TUZ,GIY,GSY,TFLO,VMBS,CWB,FLOT,STPZ,MUAC,SCHR,BABZ,HYXU,GMTB,MUNI,WIP,MUAD,QLTB,SCHP,GMMB,MUAE,IPE,NYF,BNDX,MUAF,HYMB,TIPZ,CMF,LAG,ILTB,ITE,CLY,VGSH,VGIT,LTPZ,BABS,HYHG,EMCB,DVYL,VGLT,DHS,TLO,VWOB,IGHG,GLCB,RAVI,VCSH,BSV,BND,BIV,ISHG,SDYL,VCIT,SHY,BLV,HYG,VCLT,TENZ,DTN,BIL,AUD,DLN,DTD,FTSD,CAD,STIP,CORP,HYS,HOLD,TRSY,IEF,IBDA,COBO,BOND,MINT,MBB,CSJ,AGG,SUB,EMB,CIU,GVI,MUB,GBF,TIP,AGZ,CFT,LQD,TLT,IEI,TLH,DIA,BSJF,MONY&types=quote,stats&token=
  return compute(parsePhotos, response.body);
}

// A function that converts a response body into a List<Photo>.
List<Photo> parsePhotos(String responseBody) {
  //final parsed = json.decode(responseBody).cast<Map<String,dynamic>>();

  //return parsed.map<Photo>((json) => Photo.fromJson(json)).toList();

  dynamic Obj = json.decode(responseBody);
  debugPrint(responseBody, wrapWidth: 8192);
  print(Obj.length);

  List<Photo> photoList = [];
  Obj.forEach((k, v) => photoList.add(Photo(k,v)));

  return photoList;
}

class Photo {
  String symbol;
  //String companyName;
  dynamic data;
 // dynamic iexClose;
 // dynamic quote;
  Photo(this.symbol ,this.data);

}

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override

  Widget build(BuildContext context) {

    final appTitle = 'Monthly Paying ETFs';

    return MaterialApp(
      title: appTitle,
      home: MyHomePage(title: appTitle),

    );
  }
}

class MyHomePage extends StatelessWidget {

  final String title;

  MyHomePage({Key key, this.title}) : super(key: key);

  @override
  Widget build(BuildContext context) {

    return Scaffold(

        drawer: Drawer(
          // Add a ListView to the drawer. This ensures the user can scroll
          // through the options in the drawer if there isn't enough vertical
          // space to fit everything.
          child: ListView(
            // Important: Remove any padding from the ListView.
            padding: EdgeInsets.zero,
            children: <Widget>[
              DrawerHeader(
                child: Text('About'),
                decoration: BoxDecoration(
                  color: Colors.grey,
                ),
              ),
              ListTile(
                title: Text('This app is to provide the list of ETF s that pay monthly dividend'),

                onTap: () {
                  // Update the state of the app
                  // ...
                  // Then close the drawer
                  Navigator.pop(context);
                },

              ),
              ListTile(
                title: Text('for questions or feedback please contact me at  '),

                onTap: () {
                  // Update the state of the app
                  // ...
                  // Then close the drawer
                  Navigator.pop(context);
                },

              ),

            ],
          ),
        ),

        appBar: AppBar(
        title: Text(title),
          backgroundColor: Colors.greenAccent,
      ),

      body: FutureBuilder<List<Photo>>(

        future: fetchPhotos(http.Client()),

        builder: (context, snapshot) {
          if (snapshot.hasError) print(snapshot.error);

          return snapshot.hasData
              ? PhotosList(photos: snapshot.data)
              : Center(child: CircularProgressIndicator());

        },
      ),
    );
  }
}

class PhotosList extends StatefulWidget {
  final List photos;

  PhotosList({Key key, this.photos})
      : assert(photos != null),
        super(key: key);

  @override
  _PhotosListState createState() => _PhotosListState();
}

class _PhotosListState extends State<PhotosList> {
  @override

  Widget build(BuildContext context) {

    return bodyData();

  }

  SingleChildScrollView bodyData() =>

    SingleChildScrollView(
  scrollDirection: Axis.vertical,

      // padding: EdgeInsets.all(0.0),
       //padding: const EdgeInsets.symmetric(
       //  padding: new EdgeInsets.fromLTRB(0.001, .001, 1.0, 1.0),
       padding: EdgeInsets.all(0.05),

 // child: FittedBox(fit:BoxFit.contain,

  child:SingleChildScrollView(
    scrollDirection: Axis.horizontal,

  child:
  FittedBox(
  fit: BoxFit.fitHeight,
  child: DataTable(
         // sortColumnIndex: 1,
        //  sortAscending: true,

          columns: <DataColumn>[
            DataColumn(
              label: Text("Company"),
              onSort: (_, __) {
                setState(() {
                  widget.photos.sort((a, b) =>
                      a.data["quote"]["companyName"]
                          .compareTo(b.data["quote"]["companyName"]));
                });
              },
            ),

            DataColumn(
              label: Text("ttmDivRate"),
              numeric: true,
              onSort:   (_,__) {
                setState(() {
                  widget.photos.sort((a, b) =>
                      a.data["quote"]["ttmDividendRate"]
                          .compareTo(b.data["quote"]["ttmDividendRate"]));
                });
              },
            ),

            DataColumn(
              label: Text("Price"),
              numeric: true,
              onSort: (_, __) {
                setState(() {
                  widget.photos.sort((a, b) => a.data ["quote"]["latestPrice"]
                      .compareTo(b.data["quote"]["latestPrice"]));
                });
              },
            ),

          ],

          rows: widget.photos

              .map(
                (photo) =>

                DataRow(
                  cells: [

                    DataCell(
                      Text('${photo.data["stats"]["companyName"] ?? ""}'),
                    ),

                    DataCell(
                      Text('${photo.data["stats"]["ttmDividendRate"] ?? ""}'),
                   ),
//["quote"]["stats"]
                    DataCell(
                      Text('${photo.data["quote"]["stats"]["latestPrice"] ?? ""}')
                    ),

                  ],
                ),

          )

              .toList())

),
   ),

    );

}

The issue is that values are there and Flutter says is null when the output is in the console.

===================
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running Xcode build...
Xcode build done.                                           17.9s
Waiting for iPhone 11 Pro Max to report its views...
Debug service listening on ws://127.0.0.1:57768/yyPV-GQyldg=/ws
Syncing files to device iPhone 11 Pro Max...
flutter: {"PGX":{"stats":{"week52change":-0.025465,"week52high":15.28,"week52low":9.71,"marketcap":4595628000,"employees":null,"day200MovingAvg":14.55,"day50MovingAvg":13.39,"float":null,"avg10Volume":2336007.5,"avg30Volume":2648722.77,"ttmEPS":null,"ttmDividendRate":0.8361,"companyName":"Invesco Preferred ETF","sharesOutstanding":324550000,"maxChangePercent":-0.3042,"year5ChangePercent":-0.0367,"year2ChangePercent":-0.0167,"year1ChangePercent":-0.025465,"ytdChangePercent":-0.064111,"month6ChangePercent":-0.045822,"month3ChangePercent":-0.052209,"month1ChangePercent":0.019438,"day30ChangePercent":0.028322,"day5ChangePercent":0.015054,"nextDividendDate":"2020-05-18","dividendYield":0.059046610169491524,"nextEarningsDate":null,"exDividendDate":"2020-05-18","peRatio":null,"beta":0.5684535732534528},"quote":{"symbol":"PGX","companyName":"Invesco Preferred ETF","primaryExchange":"NYSE Arca","calculationPrice":"close","open":14.11,"openTime":1590154200191,"openSource":"official","close":14.16,"closeT<…>
flutter: 2020","latestUpdate":1590177600180,"latestVolume":4747,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":11.245,"delayedPriceTime":1590192000004,"oddLotDelayedPrice":11.193,"oddLotDelayedPriceTime":1590173727614,"extendedPrice":11.245,"extendedChange":0.005,"extendedChangePercent":0.00044,"extendedPriceTime":1590186600005,"previousClose":11.16,"previousVolume":8688,"change":0.08,"changePercent":0.00717,"volume":4747,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":12262,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"iexOpen":null,"iexOpenTime":null,"iexClose":11.04,"iexCloseTime":1589988569572,"marketCap":35406000,"peRatio":null,"week52High":16.6,"week52Low":8.47,"ytdChange":-0.300712,"lastTradeTime":1590177600181,"isUSMarketOpen":false}},"IPFF":{"stats":{"week52change":-0.23383400000000001,"week52high":15.71,"week52low":8.38,"marketcap":28738500,"employees":null,"day200MovingAvg":13.89,"day50MovingAvg":10.96,"float<…>
flutter: 95
flutter: {"PGX":{"stats":{"week52change":-0.025465,"week52high":15.28,"week52low":9.71,"marketcap":4595628000,"employees":null,"day200MovingAvg":14.55,"day50MovingAvg":13.39,"float":null,"avg10Volume":2336007.5,"avg30Volume":2648722.77,"ttmEPS":null,"ttmDividendRate":0.8361,"companyName":"Invesco Preferred ETF","sharesOutstanding":324550000,"maxChangePercent":-0.3042,"year5ChangePercent":-0.0367,"year2ChangePercent":-0.0167,"year1ChangePercent":-0.025465,"ytdChangePercent":-0.064111,"month6ChangePercent":-0.045822,"month3ChangePercent":-0.052209,"month1ChangePercent":0.019438,"day30ChangePercent":0.028322,"day5ChangePercent":0.015054,"nextDividendDate":"2020-05-18","dividendYield":0.059046610169491524,"nextEarningsDate":null,"exDividendDate":"2020-05-18","peRatio":null,"beta":0.5684535732534528},"**quote":{"symbol":"PGX","companyName":"Invesco Preferred ETF","primaryExchange":"NYSE Arca","calculationPrice":"close","open":14.11,"openTime":1590154200191,"openSource":"official","close":14.16,"closeT<…>
flutter: 2020","latestUpdate":1590177600180,"latestVolume":4747,"iexRealtimePrice":null,"iexRealtimeSize":null,"iexLastUpdated":null,"delayedPrice":11.245,"delayedPriceTime":1590192000004,"oddLotDelayedPrice":11.193,"oddLotDelayedPriceTime":1590173727614,"extendedPrice":11.245,"extendedChange":0.005,"extendedChangePercent":0.00044,"extendedPriceTime":1590186600005,"previousClose":11.16,"previousVolume":8688,"change":0.08,"changePercent":0.00717,"volume":4747,"iexMarketPercent":null,"iexVolume":null,"avgTotalVolume":12262,"iexBidPrice":null,"iexBidSize":null,"iexAskPrice":null,"iexAskSize":null,"iexOpen":null,"iexOpenTime":null,"iexClose":11.04,"iexCloseTime":1589988569572,"marketCap":35406000,"peRatio":null,"week52High":16.6,"week52Low":8.47,"ytdChange":-0.300712,"lastTradeTime":1590177600181,"isUSMarketOpen":false}},"IPFF":{"stats":{"week52change":-0.23383400000000001,"week52high":15.71,"week52low":8.38,"marketcap":28738500,"employees":null,"day200MovingAvg":13.89,"day50MovingAvg":10.96,"float<…>
flutter: 95**

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following NoSuchMethodError was thrown building photorealist(dirty, state: _PhotosListState#8eef8):
The method '[]' was called on null.
Receiver: null
Tried calling: []("iexClose")

=============
Column Price is empty.
If I try to call  "delayedPrice":11.552," or "iexClose":11.04. it does not print in the app.

Body:
In the response, for some companies (or symbol) the quote value is null.

Example(IEMF, EU, etc):

     "IEMF": {
          "stats": {
               "symbol": "IEMF",
               "nextDividendDate": null,
               "nextEarningsDate": null,
               "exDividendDate": null,
               "peRatio": null,
               "beta": null
          },
          "quote": null
     },
     "EU": {
          "stats": {
               "symbol": "EU",
               "nextDividendDate": null,
               "nextEarningsDate": null,
               "exDividendDate": null,
               "peRatio": null,
               "beta": null
          },
          "quote": null
     },

Check:

photo.data["quote"] != null

And there is no stats inside quote. so don't call photo.data["quote"]["stats"]

Instead of Text('${photo.data["quote"]["stats"]["latestPrice"] ?? ""}'), use Text('${(photo.data["quote"] != null ? photo.data["quote"]["latestPrice"] : "") ?? ""}')

Full Code:

import 'dart:async';
import 'dart:convert';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;

//import 'package:flutter_web/material.dart';
//import 'package:flutter/main.dart' as app;
//import 'package:flutter_web_ui/ui.dart' as ui;

Future<List<Photo>> fetchPhotos(http.Client client) async {
  final response =
      // await client.get('https://cloud.iexapis.com/stable/stock/market/batch?symbols=CNPF,ICOL,PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,IEI,TLH,DIA,BSJF,MONY&types=quote,stats&token=');
      await client.get(
    'https://cloud.iexapis.com/stable/stock/market/batch?symbols=PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,PGF,SNLN,DVHL,AUNZ,MDIV,PHB,PFXF,FPE,TIPX,MLN,SDIV,SIPE,SEMF,EMAG,IEMF,EU,BSCM,LEMF,BSCL,BSCK,BSCJ,BSCI,DSUM,BSCF,KBWD,PCEF,BSCG,BSCH,HYEM,ITM,BKLN,PGHY,IBCE,PZT,IJNK,XMPT,THHY,QYLD,IHY,IYLD,SHYD,PRB,DVHI,GOVT,BSJJ,BSJK,RIGS,INY,IBCD,PZA,PFIG,IBCC,BSCE,PVI,MBG,CXA,FWDB,DIV,CHLC,BSJI,FLTR,PWZ,MUAH,IBDD,PICB,IBDB,BSJH,RVNU,BSJG,IBDC,XOVR,BSJE,EBND,PCY,BWX,SJNK,DES,ANGL,BAB,SST,EMCD,CBND,HYD,PLW,SCPB,FLRN,BWZ,KBWY,ELD,IBND,AOK,RWXL,ITR,DON,DGRS,JNK,TZD,EPU,PFF,HYLD,GGOV,ULST,SPHD,HFIN,DGRW,LWC,ALD,LEMB,AGND,ITIP,EMHY,QLTC,TFI,SRLN,HYLS,SHM,GNMA,CEMB,IGOV,MINC,AGZD,FTSL,SPLV,GHYG,ISTB,ENGN,CMBS,GTIP,SCHO,SMMU,QLTA,SCHZ,HSPX,TUZ,GIY,GSY,TFLO,VMBS,CWB,FLOT,STPZ,MUAC,SCHR,BABZ,HYXU,GMTB,MUNI,WIP,MUAD,QLTB,SCHP,GMMB,MUAE,IPE,NYF,BNDX,MUAF,HYMB,TIPZ,CMF,LAG,ILTB,ITE,CLY,VGSH,VGIT,LTPZ,BABS,HYHG,EMCB,DVYL,VGLT,DHS,TLO,VWOB,IGHG,GLCB,RAVI,VCSH,BSV,BND,BIV,ISHG,SDYL,VCIT,SHY,BLV,HYG,VCLT,TENZ,DTN,BIL,AUD,DLN,DTD,FTSD,CAD,STIP,CORP,HYS,HOLD,TRSY,IEF,IBDA,COBO,BOND,MINT,MBB,CSJ,AGG,SUB,EMB,CIU,GVI,MUB,GBF,TIP,AGZ,CFT,LQD,TLT,IEI,TLH,DIA,BSJF,MONY&types=stats,quote&token=pk_fd71da12cae34ae9abdf3df4958302fe',
  );
  //https://cloud.iexapis.com/v1/stock/market/batch?&types=price&symbols=aapl,fb,tsla&token=YOUR_TOKEN_HERE
  //https://cloud.iexapis.com/v1/stock/market/batch?&types=quote&symbols=aapl,fb,tsla&token=
  // Use the compute function to run parsePhotos in a separate isolate.
  //https://cloud.iexapis.com/stable/stock/market/batch?symbols=CNPF,ICOL,PGX,MORL,EMLC,GYLD,IPFF,SMB,YDIV,YYY,PEY,PGF,SNLN,DVHL,AUNZ,MDIV,PHB,PFXF,FPE,TIPX,MLN,SDIV,SIPE,SEMF,EMAG,IEMF,EU,BSCM,LEMF,BSCL,BSCK,BSCJ,BSCI,DSUM,BSCF,KBWD,PCEF,BSCG,BSCH,HYEM,ITM,BKLN,PGHY,IBCE,PZT,IJNK,XMPT,THHY,QYLD,IHY,IYLD,SHYD,PRB,DVHI,GOVT,BSJJ,BSJK,RIGS,INY,IBCD,PZA,PFIG,IBCC,BSCE,PVI,MBG,CXA,FWDB,DIV,CHLC,BSJI,FLTR,PWZ,MUAH,IBDD,PICB,IBDB,BSJH,RVNU,BSJG,IBDC,XOVR,BSJE,EBND,PCY,BWX,SJNK,DES,ANGL,BAB,SST,EMCD,CBND,HYD,PLW,SCPB,FLRN,BWZ,KBWY,ELD,IBND,AOK,RWXL,ITR,DON,DGRS,JNK,TZD,EPU,PFF,HYLD,GGOV,ULST,SPHD,HFIN,DGRW,LWC,ALD,LEMB,AGND,ITIP,EMHY,QLTC,TFI,SRLN,HYLS,SHM,GNMA,CEMB,IGOV,MINC,AGZD,FTSL,SPLV,GHYG,ISTB,ENGN,CMBS,GTIP,SCHO,SMMU,QLTA,SCHZ,HSPX,TUZ,GIY,GSY,TFLO,VMBS,CWB,FLOT,STPZ,MUAC,SCHR,BABZ,HYXU,GMTB,MUNI,WIP,MUAD,QLTB,SCHP,GMMB,MUAE,IPE,NYF,BNDX,MUAF,HYMB,TIPZ,CMF,LAG,ILTB,ITE,CLY,VGSH,VGIT,LTPZ,BABS,HYHG,EMCB,DVYL,VGLT,DHS,TLO,VWOB,IGHG,GLCB,RAVI,VCSH,BSV,BND,BIV,ISHG,SDYL,VCIT,SHY,BLV,HYG,VCLT,TENZ,DTN,BIL,AUD,DLN,DTD,FTSD,CAD,STIP,CORP,HYS,HOLD,TRSY,IEF,IBDA,COBO,BOND,MINT,MBB,CSJ,AGG,SUB,EMB,CIU,GVI,MUB,GBF,TIP,AGZ,CFT,LQD,TLT,IEI,TLH,DIA,BSJF,MONY&types=quote,stats&token=
  return compute(parsePhotos, response.body);
}

// A function that converts a response body into a List<Photo>.
List<Photo> parsePhotos(String responseBody) {
  //final parsed = json.decode(responseBody).cast<Map<String,dynamic>>();

  //return parsed.map<Photo>((json) => Photo.fromJson(json)).toList();

  dynamic obj = json.decode(responseBody);
  debugPrint(responseBody, wrapWidth: 1000);
  print(obj.length);

  List<Photo> photoList = [];
  obj.forEach((k, v) => photoList.add(Photo(k, v)));

  return photoList;
}

class Photo {
  String symbol;

  //String companyName;
  dynamic data;

  // dynamic iexClose;
  // dynamic quote;
  Photo(this.symbol, this.data);
}

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final appTitle = 'Monthly Paying ETFs';

    return MaterialApp(
      title: appTitle,
      home: MyHomePage(title: appTitle),
    );
  }
}

class MyHomePage extends StatelessWidget {
  final String title;

  MyHomePage({Key key, this.title}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      drawer: Drawer(
        // Add a ListView to the drawer. This ensures the user can scroll
        // through the options in the drawer if there isn't enough vertical
        // space to fit everything.
        child: ListView(
          // Important: Remove any padding from the ListView.
          padding: EdgeInsets.zero,
          children: <Widget>[
            DrawerHeader(
              child: Text('About'),
              decoration: BoxDecoration(
                color: Colors.grey,
              ),
            ),
            ListTile(
              title: Text(
                'This app is to provide the list of ETF s that pay monthly dividend',
              ),
              onTap: () {
                // Update the state of the app
                // ...
                // Then close the drawer
                Navigator.pop(context);
              },
            ),
            ListTile(
              title: Text(
                'for questions or feedback please contact me at  ',
              ),
              onTap: () {
                // Update the state of the app
                // ...
                // Then close the drawer
                Navigator.pop(context);
              },
            ),
          ],
        ),
      ),
      appBar: AppBar(
        title: Text(title),
        backgroundColor: Colors.greenAccent,
      ),
      body: FutureBuilder<List<Photo>>(
        future: fetchPhotos(http.Client()),
        builder: (context, snapshot) {
          if (snapshot.hasError) print(snapshot.error);

          return snapshot.hasData
              ? PhotosList(photos: snapshot.data)
              : Center(
                  child: CircularProgressIndicator(),
                );
        },
      ),
    );
  }
}

class PhotosList extends StatefulWidget {
  final List photos;

  PhotosList({Key key, this.photos})
      : assert(photos != null),
        super(key: key);

  @override
  _PhotosListState createState() => _PhotosListState();
}

class _PhotosListState extends State<PhotosList> {
  @override
  Widget build(BuildContext context) {
    return bodyData();
  }

  SingleChildScrollView bodyData() => SingleChildScrollView(
        scrollDirection: Axis.vertical,

        // padding: EdgeInsets.all(0.0),
        //padding: const EdgeInsets.symmetric(
        //  padding: new EdgeInsets.fromLTRB(0.001, .001, 1.0, 1.0),
        padding: EdgeInsets.all(0.05),

        // child: FittedBox(fit:BoxFit.contain,

        child: SingleChildScrollView(
          scrollDirection: Axis.horizontal,
          child: FittedBox(
            fit: BoxFit.fitHeight,
            child: DataTable(
              // sortColumnIndex: 1,
              //  sortAscending: true,

              columns: <DataColumn>[
                DataColumn(
                  label: Text("Company"),
                  onSort: (_, __) {
                    setState(() {
                      widget.photos.sort((a, b) => a.data["quote"]
                              ["companyName"]
                          .compareTo(b.data["quote"]["companyName"]));
                    });
                  },
                ),
                DataColumn(
                  label: Text("ttmDivRate"),
                  numeric: true,
                  onSort: (_, __) {
                    setState(() {
                      widget.photos.sort((a, b) => a.data["quote"]
                              ["ttmDividendRate"]
                          .compareTo(b.data["quote"]["ttmDividendRate"]));
                    });
                  },
                ),
                DataColumn(
                  label: Text("Price"),
                  numeric: true,
                  onSort: (_, __) {
                    setState(() {
                      widget.photos.sort((a, b) => a.data["quote"]
                              ["latestPrice"]
                          .compareTo(b.data["quote"]["latestPrice"]));
                    });
                  },
                ),
              ],
              rows: widget.photos
                  .map(
                    (photo) => DataRow(
                      cells: [
                        DataCell(
                          Text(
                            '${photo.data["stats"]["companyName"] ?? ""}',
                          ),
                        ),

                        DataCell(
                          Text(
                            '${photo.data["stats"]["ttmDividendRate"] ?? ""}',
                          ),
                        ),
//["quote"]["stats"]
                        DataCell(
                          Text(
                            '${(photo.data["quote"] != null ? photo.data["quote"]["latestPrice"] : "") ?? ""}',
                          ),
                        ),
                      ],
                    ),
                  )
                  .toList(),
            ),
          ),
        ),
      );
}


来源: stackexchange

问:
Python Pandas: Calculate moving average within group
I have a dataframe containing time series for 100 objects:

```<code>object  period  value
1       1       24
1       2       67
...
1       1000    56
2       1       59
2       2       46
...
2       1000    64
3       1       54
...
100     1       451
100     2       153
...
100     1000    21
</code>```

I want to calculate moving average with window 10 for the value column. I guess I have to do something like

```<code>df.groupby('object').apply(lambda ~calculate MA~)
</code>```

and then merge this Series to the original dataframe by object? Can't figure out exact commands

答:
The answers provided may not produce the desired results if you are grouping on multiple columns.

The following should cut it:

```<code>df['moving'] = df.groupby(['col_1', 'col_2', 'col_3']).rolling(10)['value'].mean().droplevel(level=[0,1,2])
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have a dataframe containing time series for 100 objects:

object  period  value
1       1       24
1       2       67
...
1       1000    56
2       1       59
2       2       46
...
2       1000    64
3       1       54
...
100     1       451
100     2       153
...
100     1000    21

I want to calculate moving average with window 10 for the value column. I guess I have to do something like

df.groupby('object').apply(lambda ~calculate MA~)

and then merge this Series to the original dataframe by object? Can't figure out exact commands

Body:
The answers provided may not produce the desired results if you are grouping on multiple columns.

The following should cut it:

df['moving'] = df.groupby(['col_1', 'col_2', 'col_3']).rolling(10)['value'].mean().droplevel(level=[0,1,2])


问:
What type of Authentication System does Django use out of the box?
What type of Authentication System does Django use out of the box?

Looks to me like Session Based Authentication?

答:
As per the docs:

Authentication in Web requests

Django uses sessions and middleware to hook the authentication system into request objects.

These provide a request.user attribute on every request which represents the current user. If the current user has not logged in, this attribute will be set to an instance of AnonymousUser, otherwise it will be an instance of User.

You can tell them apart with is_authenticated, like so:

```<code>if request.user.is_authenticated:
    # Do something for authenticated users.
    ...
else:
    # Do something for anonymous users.
    ...
</code>```

Body:
As per the docs:

Authentication in Web requests

Django uses sessions and middleware to hook the authentication system into request objects.

These provide a request.user attribute on every request which represents the current user. If the current user has not logged in, this attribute will be set to an instance of AnonymousUser, otherwise it will be an instance of User.

You can tell them apart with is_authenticated, like so:

if request.user.is_authenticated:
    # Do something for authenticated users.
    ...
else:
    # Do something for anonymous users.
    ...


问:
How to show WooCommerce Categories on 'shop' page instead of products?
I have seen this question and answer. That does not work.

Setup

I am running:

WordPress 5.4.1

WooCommerce 4.1.1

I have a custom theme that overrides some of the WooCommerce templates by placing my own templates in: themes/my_theme/woocommerce/template-name.php

I have established that the shop page (homepage) uses the template archive-product.php. I have copied the this from plugins/woocommerce/templates/archive-product.php into my theme and made some minor HTML changes which work perfectly. There are no functional changes in my theme's copy, just some HTML.

The problem

I want the homepage to only show the store categories, as thumbnails. There is an option to set the shop page to show categories instead of products:

Appearance > Customize > WooCommerce > Catalogue

Shop page display has been set to Show Categories

However the shop homepage seems to ignore this setting entirely, and it still shows the products. It seems surprising that WooCommerce's own template does not honour this setting!

How do I find this setting in the template and then show the categories (as thumbnails) on the shop homepage?

Is there an equivalent to woocommerce_product_loop() for looping categories?

As a side note, the Storefront theme does honour the setting but Storefront does not have the template archive-product.php. Storefront seems to be highly abstracted and after much debugging of it / trying to take it apart I have so far not worked out which template file it is using for the shop page.

My theme is already in production and I just want to make an update so that the homepage shows the categories instead of going directly into the products list.

答:
I found a workable solution. The WooCommerce default templates don't support the setting to show categories on the Shop page.

However using a shortcode with do_shortcode(), and a condition this can be achieved as follows:

```<code>if (is_shop()) {

  echo do_shortcode('[product_categories hide_empty="0"]');

} else {

  woocommerce_product_loop_start();

  if ( wc_get_loop_prop( 'total' ) ) {
    while ( have_posts() ) {
      the_post();

      /**
      * Hook: woocommerce_shop_loop.
      */
      do_action( 'woocommerce_shop_loop' );

      wc_get_template_part( 'content', 'product' );
    }

  }

  woocommerce_product_loop_end();
}
</code>```

Still:

I would like to know how to pick up the 'show categories' customisation setting shown in the question, so my theme responds to that.

Is there a better way than using do_shortcode(), this feels like a bit of a hack

Body:
I found a workable solution. The WooCommerce default templates don't support the setting to show categories on the Shop page.

However using a shortcode with do_shortcode(), and a condition this can be achieved as follows:

if (is_shop()) {

  echo do_shortcode('[product_categories hide_empty="0"]');

} else {

  woocommerce_product_loop_start();

  if ( wc_get_loop_prop( 'total' ) ) {
    while ( have_posts() ) {
      the_post();

      /**
      * Hook: woocommerce_shop_loop.
      */
      do_action( 'woocommerce_shop_loop' );

      wc_get_template_part( 'content', 'product' );
    }

  }

  woocommerce_product_loop_end();
}

Still:

I would like to know how to pick up the 'show categories' customisation setting shown in the question, so my theme responds to that.

Is there a better way than using do_shortcode(), this feels like a bit of a hack


问:
Running keras tokenizer in loop
I have a multiple files with different structure I would like to tokenize.

For example file 1:

event_name, event_location, event_description, event_priority

file2:

event_name, event_participants, event_location,event_description,  event_priority

and so on. I would like to create create an array with data from all files and then tokenize it. unfortunately when I run tokenizer.fit_on_texts() in loop dictionary is not expanding but is overwritten. I have to use tokenizer in loop because I need to pad event_description

my code:

```<code>    tokenizer = Tokenizer(num_words=50000, oov_token="<OOV>")
    for file in files:
        print("Loading : ", file)
        events= pd.read_csv(file)
        # prepare columns
        events['event_name'] = 'XXBOS XXEN ' + events['event_name'].astype(str)
        events['event_location'] = 'XXEL ' + events['event_location'].astype(str)
        events['event_description'] = 'XXED ' + events['event_description'].astype(str)
        events['event_priority'] = 'XXEP ' + events['event_priority'].astype(str) + ' XXEOS'
        # Tokenize concatenated columns into one
        tokenizer.fit_on_texts(np.concatenate((events['event_name'],events['event_location'], events['event_description'], events['event_priority']), axis=0))
        # Later I run texts_to_sequences on each column so later i am able to run pad_sequences on it and again I concatenate them
</code>```

When I check tokenizer.word_index, the tokens like XXBOS location is changing between loop iterations. Is it possible to fulfill word_index dictionary instead of overwriting it?

EDIT:
experiment:

```<code>from tensorflow.keras.preprocessing.text import Tokenizer
tokenizer = Tokenizer(filters='.!"#$%&()*+,-/:;<=>?@[\\]^_`{|}~\t\n', num_words=50000, oov_token="<OOV>", split=' ', char_level=False)
text = "some text for test"
tokenizer.word_index
{'<OOV>': 1, 't': 2, 'e': 3, 's': 4, 'o': 5, 'm': 6, 'x': 7, 'f': 8, 'r': 9}
</code>```

and adding another text to fit:

```<code>text2="new sentence with unknown chars xxasqeew"
tokenizer.fit_on_texts(text2)
tokenizer.word_index
{'<OOV>': 1, 'e': 2, 't': 3, 'n': 4, 's': 5, 'w': 6, 'o': 7, 'x': 8, 'r': 9, 'c': 10, 'h': 11, 'a': 12, 'm': 13, 'f': 14, 'i': 15, 'u': 16, 'k': 17, 'q': 18}
</code>```

indexes in tokenizer changed completely

答:
The dict is not overwritten, it is updated. The words' ordering changes after each iteration because fit_on_texts sorts word index by the number of word's occurences (eg. the most common word is at the index "1", second most common at index "2", etc. ("0" index is reserved)).

An example:

```<code>from tensorflow.keras.preprocessing.text import Tokenizer

tokenizer = Tokenizer()

text1 = ["aaa bbb ccc"]
tokenizer.fit_on_texts(text1)
print("1. iteration", tokenizer.word_index)

text2 = ["bbb ccc ddd"]
tokenizer.fit_on_texts(text2)
print("2. iteration", tokenizer.word_index)

text3 = ["ccc ddd eee"]
tokenizer.fit_on_texts(text3)
print("3. iteration", tokenizer.word_index)

# "ccc" occurs three times
# "bbb" occurs twice
# "ddd" occurs twice
# "aaa" occurs once
# "eee" occurs once

# The actual output:
# 1. iteration {'aaa': 1, 'bbb': 2, 'ccc': 3}
# 2. iteration {'bbb': 1, 'ccc': 2, 'aaa': 3, 'ddd': 4}
# 3. iteration {'ccc': 1, 'bbb': 2, 'ddd': 3, 'aaa': 4, 'eee': 5}
</code>```

Title: Running keras tokenizer in loop

Body:
I have a multiple files with different structure I would like to tokenize.

For example file 1:

event_name, event_location, event_description, event_priority

file2:

event_name, event_participants, event_location,event_description,  event_priority

and so on. I would like to create create an array with data from all files and then tokenize it. unfortunately when I run tokenizer.fit_on_texts() in loop dictionary is not expanding but is overwritten. I have to use tokenizer in loop because I need to pad event_description

my code:

    tokenizer = Tokenizer(num_words=50000, oov_token="<OOV>")
    for file in files:
        print("Loading : ", file)
        events= pd.read_csv(file)
        # prepare columns
        events['event_name'] = 'XXBOS XXEN ' + events['event_name'].astype(str)
        events['event_location'] = 'XXEL ' + events['event_location'].astype(str)
        events['event_description'] = 'XXED ' + events['event_description'].astype(str)
        events['event_priority'] = 'XXEP ' + events['event_priority'].astype(str) + ' XXEOS'
        # Tokenize concatenated columns into one
        tokenizer.fit_on_texts(np.concatenate((events['event_name'],events['event_location'], events['event_description'], events['event_priority']), axis=0))
        # Later I run texts_to_sequences on each column so later i am able to run pad_sequences on it and again I concatenate them

When I check tokenizer.word_index, the tokens like XXBOS location is changing between loop iterations. Is it possible to fulfill word_index dictionary instead of overwriting it?

EDIT:
experiment:

from tensorflow.keras.preprocessing.text import Tokenizer
tokenizer = Tokenizer(filters='.!"#$%&()*+,-/:;<=>?@[\\]^_`{|}~\t\n', num_words=50000, oov_token="<OOV>", split=' ', char_level=False)
text = "some text for test"
tokenizer.word_index
{'<OOV>': 1, 't': 2, 'e': 3, 's': 4, 'o': 5, 'm': 6, 'x': 7, 'f': 8, 'r': 9}

and adding another text to fit:

text2="new sentence with unknown chars xxasqeew"
tokenizer.fit_on_texts(text2)
tokenizer.word_index
{'<OOV>': 1, 'e': 2, 't': 3, 'n': 4, 's': 5, 'w': 6, 'o': 7, 'x': 8, 'r': 9, 'c': 10, 'h': 11, 'a': 12, 'm': 13, 'f': 14, 'i': 15, 'u': 16, 'k': 17, 'q': 18}

indexes in tokenizer changed completely

Body:
The dict is not overwritten, it is updated. The words' ordering changes after each iteration because fit_on_texts sorts word index by the number of word's occurences (eg. the most common word is at the index "1", second most common at index "2", etc. ("0" index is reserved)).

An example:

from tensorflow.keras.preprocessing.text import Tokenizer

tokenizer = Tokenizer()

text1 = ["aaa bbb ccc"]
tokenizer.fit_on_texts(text1)
print("1. iteration", tokenizer.word_index)

text2 = ["bbb ccc ddd"]
tokenizer.fit_on_texts(text2)
print("2. iteration", tokenizer.word_index)

text3 = ["ccc ddd eee"]
tokenizer.fit_on_texts(text3)
print("3. iteration", tokenizer.word_index)

# "ccc" occurs three times
# "bbb" occurs twice
# "ddd" occurs twice
# "aaa" occurs once
# "eee" occurs once

# The actual output:
# 1. iteration {'aaa': 1, 'bbb': 2, 'ccc': 3}
# 2. iteration {'bbb': 1, 'ccc': 2, 'aaa': 3, 'ddd': 4}
# 3. iteration {'ccc': 1, 'bbb': 2, 'ddd': 3, 'aaa': 4, 'eee': 5}


问:
Is there a way to code a large array of objects in a much shorter way?
I am doing a personal project in react.js but at this moment I am trying to write clean code. Could exist a way to write shorter this code in two lines? or something like that. I tried to make objects of arrays like

```<code>const apps= {app_name:['Maps','Meet'], position:['0 2323', '0 2323'}
</code>```

but It does not work

const apps = [
  {
    app_name: 'Maps',
    position: '0 -828px'
  },
  {
    app_name: 'Gmail',
    position: '0 -483px'
  },
  {
    app_name: 'Calendar',
    position: '0 -2553px'
  },
  {
    app_name: 'Drive',
    position: '0 -2277px'
  }
];
```

<p>There is not a way to rewrite it in a more shorter way in order to make the map's function works?</p>

<pre class="lang-js prettyprint-override"><code>{apps.map((el, i) =>
    <li className='items'>

            <div className='img_box'>
                <span className='img'
                  style={ { backgroundPosition: el.position } }></span>
            </div>
            <span className='app_name'>{el.app_name}</span>

    </li>
)}

</code>```

答:
This might be more compact, it comes down to personal preference.

You could create two arrays:

const appNames = ['Maps', 'Gmail', 'Calendar', 'Drive'];
const positions = ['0 -828px', '0 -483px', '0 -2553px', '0 -2277px'];
```

<p>Then use the arrays to form your final array:</p>

<pre class="lang-js prettyprint-override"><code>let apps = appNames.map((el, i) => {
  return { app_name: el, position: positions[i] };
});
</code>```

const appNames = ['Maps', 'Gmail', 'Calendar', 'Drive'];
const positions = ['0 -828px', '0 -483px', '0 -2553px', '0 -2277px'];

let apps = appNames.map((el, i) => {
  return { app_name: el, position: positions[i] };
});

document.getElementById('result').innerHTML =
  'apps:' + JSON.stringify(apps, null, 2);```
<pre class="snippet-code-html lang-html prettyprint-override"><code><pre id="result">``````

Body:
I am doing a personal project in react.js but at this moment I am trying to write clean code. Could exist a way to write shorter this code in two lines? or something like that. I tried to make objects of arrays like

const apps= {app_name:['Maps','Meet'], position:['0 2323', '0 2323'}

but It does not work

const apps = [
  {
    app_name: 'Maps',
    position: '0 -828px'
  },
  {
    app_name: 'Gmail',
    position: '0 -483px'
  },
  {
    app_name: 'Calendar',
    position: '0 -2553px'
  },
  {
    app_name: 'Drive',
    position: '0 -2277px'
  }
];

There is not a way to rewrite it in a more shorter way in order to make the map's function works?

{apps.map((el, i) =>

            {el.app_name}

)}

Body:
This might be more compact, it comes down to personal preference.

You could create two arrays:

const appNames = ['Maps', 'Gmail', 'Calendar', 'Drive'];
const positions = ['0 -828px', '0 -483px', '0 -2553px', '0 -2277px'];

Then use the arrays to form your final array:

let apps = appNames.map((el, i) => {
  return { app_name: el, position: positions[i] };
});

const appNames = ['Maps', 'Gmail', 'Calendar', 'Drive'];
const positions = ['0 -828px', '0 -483px', '0 -2553px', '0 -2277px'];

let apps = appNames.map((el, i) => {
  return { app_name: el, position: positions[i] };
});

document.getElementById('result').innerHTML =
  'apps:' + JSON.stringify(apps, null, 2);

<pre id="result"></pre>


问:
Saving Files c# - without overwriting?
I am saving data to a file every 60 secs, I have it saving every 60 secs ok but it deletes the previous data added. Is there a way in which it would add to the file rather than overwrite it. And without using save dialog as it is done in the background.

Any feedback is greatly appreciated

答:
Use File class AppendText method.

```<code>StreamWriter sw = File.AppendText("D:\\Text.txt");
sw.WriteLine("Hello");
sw.WriteLine("World");
sw.WriteLine("Test");
sw.Flush();
sw.Close();
</code>```

ContentLicense: CC BY-SA 3.0

Title: Saving Files c# - without overwriting?

Body:
Use File class AppendText method.

StreamWriter sw = File.AppendText("D:\\Text.txt");
sw.WriteLine("Hello");
sw.WriteLine("World");
sw.WriteLine("Test");
sw.Flush();
sw.Close();


问:
What happened to the changes that I made using git filter-branch?
For the first time, I tried to rewrite my git history using git filter-branch. I did this by writing a (Python) script (let's call it edit_file) that makes an edit to a file (let's call it target_file). Then, I ran this command:

```<code>git filter-branch --tree-filter "path/to/edit_file" HEAD
</code>```

I got a nice stream of output which seemed to indicate that I'd gotten the effect that I wanted, but when viewed target_file, I did not see any changes. When I run edit_file directly, target_file in my working copy successfully receives the edits that I intended.

It sounds like my changes exist within some deep, dark, and dank recess in git's twisted mind, and I just need a magical incantation to summon forth my changes. I have no idea whether this is correct, nor do I understand where to begin looking, because all the material that I've read (including the official git book) indicates that once git filter-branch finishes, the branch that I am working on should have the changes that edit_file would perform on every version of target_file...

Halp?

Sorry if this is a bit long winded, but I don't know what details are necessary (because that is a core feature of being confused).

More details:

The reasons I say that it looked like filter-branch did what I wanted are:

I could see the output of edit_file running on each commit, and it indicated success on all of them. The output of edit_file changes as it operates on different versions of target_file, and I was able to see the different output from edit_file as git filter-branch moved through history.

At the end, I saw this:

```<code>Ref 'refs/heads/my-branch' was rewritten
</code>```

PS: Before doing git filter-branch, I ran

```<code>git checkout -b my-branch
</code>```

to create a new branch named my-branch (and check it out), in case git filter-branch went horribly wrong.

After seeing that git filter-branch ... left target_file unchanged, I ran git checkout -b my-branch, but I guess that did nothing. I thought it might do something, because the last line from git filter-branch seems to be saying that the branch my-branch has been changed, but I honestly do not understand what that line means.

答:
So... It looks like git filter-branch did not do anything except leave weird back up poop in the .git dir. git gc does not clean that up for whatever reason (maybe there should be a git clean-poop command as well as gc?). Not sure what will, other than

```<code>cd ..  # Assuming you are at the root of your repo
git clone --no-local original fresh-copy
cd fresh-copy
</code>```

Yes, even though we are making a local copy, --no-local is needed, because This. Is. GIIIIIIIIIT! This is probably what you should do before attempting filter-branch or filter-repo. Not sure why the documentation does not advise this, but anyway. Don't do what I did, and just skimp out by creating a new branch. Consider git filter-X to be a nuclear weapon. You don't just need bunker to protect you; you need disposable parallel universe.

After much gnashing of teeth, I was finally able to get VonC's suggestion of using git-filter-repo to work. If, like me, your platform does not have a new enough version of git to work with git-filter-repo (requires >= 2.22), you may be able to do something like

```<code>sudo add-apt-repository ppa:git-core/ppa
# followed by the usual
sudo apt-get update
# song and dance routine...
sudo apt-get install git --upgrade
</code>```

as suggested on the git *nix download page to upgrade to the "latest and greatest". That did not work for me (so take care about blindly copying and pasting the above suggestion), but apparently, I have a very deranged system, so you may have better luck than I did. Anyway...

Once you obtain a new enough version of git, the only thing you should need is the git-filter-repo script itself (amazingly, it just consists of the one main file). So just download that straight from github, and stick it anywhere on your PATH. Remember to chmod +x the shit out of it first tho.

You will most likely NOT want to use the --path flag, because that will NOT just target the one file that you want to edit. Instead, --path will nuke all other files.

With that in mind, all you need to do is something like this:

```<code>git-filter-repo --blob-callback 'import sys
sys.path.append("dir/where/your/edit_file/py/file/lives")
import my_module

new = my_module.modify(blob.data.decode())
new_bytes = new.encode()
assert isinstance(new_bytes, bytes), ""
blob.data = new_bytes
'
</code>```

Yes, that is all one command. blob.data contains the contents of whatever file git-filter-repo is examining. Furthermore, notice that it is a bytes object, not str. Let me re-emphasize a very important point: this operation goes over EVERY file (in every commit). So, your my_module.modify function better be very selective if you only intend to modify one file. (What git-filter-repo really needs is a way for your script to detect the path of blob, not just give you the contents of a file. But hopefully, you can recognize your file by its contents, not just its path.) If you mess up, it's not a big deal, because you can just nuke the fresh-copy dir and start over.

Refrain from gouging your eyes out after this ordeal. Your eyes are way too valuable to be destroyed over something as stupid as git. Feel free to have a good cry in the shower tho. Hey, at least you got it working finally, and you weren't eaten by sharks.

Oh, and another thing: the git clone you did in the first step does not copy over any submodules, because that would make sense and be too easy. Therefore, you must also do this in fresh-copy (even though git clone DOES copy over the .gitmodules file):

```<code>git submodule init
git submodule update
</code>```

PS: You may get some therapeutic value from the one of the various git man page generators available on the Interwebs. They really do read like git man pages, even though they are literally randomized gibberish.

Body:
For the first time, I tried to rewrite my git history using git filter-branch. I did this by writing a (Python) script (let's call it edit_file) that makes an edit to a file (let's call it target_file). Then, I ran this command:

git filter-branch --tree-filter "path/to/edit_file" HEAD

I got a nice stream of output which seemed to indicate that I'd gotten the effect that I wanted, but when viewed target_file, I did not see any changes. When I run edit_file directly, target_file in my working copy successfully receives the edits that I intended.

It sounds like my changes exist within some deep, dark, and dank recess in git's twisted mind, and I just need a magical incantation to summon forth my changes. I have no idea whether this is correct, nor do I understand where to begin looking, because all the material that I've read (including the official git book) indicates that once git filter-branch finishes, the branch that I am working on should have the changes that edit_file would perform on every version of target_file...

Halp?

Sorry if this is a bit long winded, but I don't know what details are necessary (because that is a core feature of being confused).

More details:

The reasons I say that it looked like filter-branch did what I wanted are:

I could see the output of edit_file running on each commit, and it indicated success on all of them. The output of edit_file changes as it operates on different versions of target_file, and I was able to see the different output from edit_file as git filter-branch moved through history.

At the end, I saw this:

Ref 'refs/heads/my-branch' was rewritten

PS: Before doing git filter-branch, I ran

git checkout -b my-branch

to create a new branch named my-branch (and check it out), in case git filter-branch went horribly wrong.

After seeing that git filter-branch ... left target_file unchanged, I ran git checkout -b my-branch, but I guess that did nothing. I thought it might do something, because the last line from git filter-branch seems to be saying that the branch my-branch has been changed, but I honestly do not understand what that line means.

Body:
So... It looks like git filter-branch did not do anything except leave weird back up poop in the .git dir. git gc does not clean that up for whatever reason (maybe there should be a git clean-poop command as well as gc?). Not sure what will, other than

cd ..  # Assuming you are at the root of your repo
git clone --no-local original fresh-copy
cd fresh-copy

Yes, even though we are making a local copy, --no-local is needed, because This. Is. GIIIIIIIIIT! This is probably what you should do before attempting filter-branch or filter-repo. Not sure why the documentation does not advise this, but anyway. Don't do what I did, and just skimp out by creating a new branch. Consider git filter-X to be a nuclear weapon. You don't just need bunker to protect you; you need disposable parallel universe.

After much gnashing of teeth, I was finally able to get VonC's suggestion of using git-filter-repo to work. If, like me, your platform does not have a new enough version of git to work with git-filter-repo (requires >= 2.22), you may be able to do something like

sudo add-apt-repository ppa:git-core/ppa
# followed by the usual
sudo apt-get update
# song and dance routine...
sudo apt-get install git --upgrade

as suggested on the git *nix download page to upgrade to the "latest and greatest". That did not work for me (so take care about blindly copying and pasting the above suggestion), but apparently, I have a very deranged system, so you may have better luck than I did. Anyway...

Once you obtain a new enough version of git, the only thing you should need is the git-filter-repo script itself (amazingly, it just consists of the one main file). So just download that straight from github, and stick it anywhere on your PATH. Remember to chmod +x the shit out of it first tho.

You will most likely NOT want to use the --path flag, because that will NOT just target the one file that you want to edit. Instead, --path will nuke all other files.

With that in mind, all you need to do is something like this:

git-filter-repo --blob-callback 'import sys
sys.path.append("dir/where/your/edit_file/py/file/lives")
import my_module

new = my_module.modify(blob.data.decode())
new_bytes = new.encode()
assert isinstance(new_bytes, bytes), ""
blob.data = new_bytes
'

Yes, that is all one command. blob.data contains the contents of whatever file git-filter-repo is examining. Furthermore, notice that it is a bytes object, not str. Let me re-emphasize a very important point: this operation goes over EVERY file (in every commit). So, your my_module.modify function better be very selective if you only intend to modify one file. (What git-filter-repo really needs is a way for your script to detect the path of blob, not just give you the contents of a file. But hopefully, you can recognize your file by its contents, not just its path.) If you mess up, it's not a big deal, because you can just nuke the fresh-copy dir and start over.

Refrain from gouging your eyes out after this ordeal. Your eyes are way too valuable to be destroyed over something as stupid as git. Feel free to have a good cry in the shower tho. Hey, at least you got it working finally, and you weren't eaten by sharks.

Oh, and another thing: the git clone you did in the first step does not copy over any submodules, because that would make sense and be too easy. Therefore, you must also do this in fresh-copy (even though git clone DOES copy over the .gitmodules file):

git submodule init
git submodule update

PS: You may get some therapeutic value from the one of the various git man page generators available on the Interwebs. They really do read like git man pages, even though they are literally randomized gibberish.


问:
Vue.js markdown filter
I'm using Evan You's example of how to convert HTML to markdown - https://jsfiddle.net/yyx990803/oe7axeab/.

Installing the marked package through npm and then implementing this leads to the error, 'marked' is not defined.

If I include the cdn link in my index.html file, the markdown is then converted to "0" and I get the error:

[Vue warn]: Property or method "marked" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

EDIT:

I tried to include it in my main.js as follows:

```<code>import App from './App.vue';
import router from './router';
import store from './store';

import './css/main.css';
import i18n from './i18n';
import marked from 'marked';

const debugSetting = window.ApplicationConfig.DEBUG;
Vue.config.debug = debugSetting;

Vue.config.productionTip = false;

new Vue({
    router,
    store,
    i18n,
    marked,

    render: function(h) {
        return h(App);
    },
}).$mount('#app');
</code>```

This doesn't feel right though, hence why I tried with the cdn just to see if that at least worked.

component

```<code><template>
    <main-layout>
        <div class="wrapper" v-html="terms | marked"></div>
    </main-layout>
</template>

<script>
import MainLayout from '@/layouts/Main.vue';

import { getTerms } from '../api';

export default {
    name: 'Terms',
    components: {
        MainLayout,
    },
    data() {
        return {
            terms,
        };
    },
    filters: {
        marked: marked,
    },
    async mounted() {
        try {
            const response = await getTerms();

            if (response) {
                this.terms = response.data;
                console.log(this.terms);
            }
        } catch (err) {
            console.log(err);
        }
    },
};
</script>
</code>```

答:
Example of how marked can be used globally.

main.js

```<code>import Vue from 'vue'
import App from './App.vue'

import router from './router'
import store from '@/store'

import marked from 'marked'

// Lets use the code below inside a components
// Vue.marked()
// this.$marked()
Vue.use({
  install () {
    Vue.marked = marked
    Vue.prototype.$marked = marked
  }
})

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
</code>```

someFile.vue

```<code><template>
    <div v-html="$marked(someMarkdownText)"></div>
</template>

export default {
    name: 'Terms',
    components: {},
    data () {
        return {
            someMarkdownText: '# hello',
        }
    },
    mounted () {}
}
</code>```

Title: Vue.js markdown filter

Body:
I'm using Evan You's example of how to convert HTML to markdown - https://jsfiddle.net/yyx990803/oe7axeab/.

Installing the marked package through npm and then implementing this leads to the error, 'marked' is not defined.

If I include the cdn link in my index.html file, the markdown is then converted to "0" and I get the error:

[Vue warn]: Property or method "marked" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

EDIT:

I tried to include it in my main.js as follows:

import App from './App.vue';
import router from './router';
import store from './store';

import './css/main.css';
import i18n from './i18n';
import marked from 'marked';

const debugSetting = window.ApplicationConfig.DEBUG;
Vue.config.debug = debugSetting;

Vue.config.productionTip = false;

new Vue({
    router,
    store,
    i18n,
    marked,

    render: function(h) {
        return h(App);
    },
}).$mount('#app');

This doesn't feel right though, hence why I tried with the cdn just to see if that at least worked.

component

<template>

</template>

Body:
Example of how marked can be used globally.

main.js

import Vue from 'vue'
import App from './App.vue'

import router from './router'
import store from '@/store'

import marked from 'marked'

// Lets use the code below inside a components
// Vue.marked()
// this.$marked()
Vue.use({
  install () {
    Vue.marked = marked
    Vue.prototype.$marked = marked
  }
})

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

someFile.vue

<template>
    <div v-html="$marked(someMarkdownText)"></div>
</template>

export default {
    name: 'Terms',
    components: {},
    data () {
        return {
            someMarkdownText: '# hello',
        }
    },
    mounted () {}
}


问:
Python rotating the elements inside subarrays
I am trying to create two subarrays in given order, in this case i have two integers a and b a represents the value of the subarrays range, and b represents how many times it needs to be rotated.

I created the subarrays like this;

```<code>def reorder(a,b):
   return [[i for i in range(0, a//2)]] + [[f for f in range(a//2, a)]]
</code>```

Imagine a is 10 and b is 1 the output is:

```<code>[[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
</code>```

But how can i reverse each subarrays b times?

The output that i want;

```<code>[[4, 0, 1, 2, 3], [9, 5, 6, 7, 8]]
</code>```

答:
You can pop the last element of each subarray b times and insert it at the beginning:

```<code>def reorder(a,b):
    suba = [i for i in range(0, a//2)]
    subb = [f for f in range(a//2, a)]
    for i in range(b):
        suba = [suba.pop(-1)]+suba
        subb = [subb.pop(-1)]+subb
    return [suba,subb]
</code>```

```<code>In[1]:  reorder(10,1)
Out[1]: [[4, 0, 1, 2, 3], [9, 5, 6, 7, 8]]
</code>```

Body:
I am trying to create two subarrays in given order, in this case i have two integers a and b a represents the value of the subarrays range, and b represents how many times it needs to be rotated.

I created the subarrays like this;

def reorder(a,b):
   return [[i for i in range(0, a//2)]] + [[f for f in range(a//2, a)]]

Imagine a is 10 and b is 1 the output is:

[[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]

But how can i reverse each subarrays b times?

The output that i want;

[[4, 0, 1, 2, 3], [9, 5, 6, 7, 8]]

Body:
You can pop the last element of each subarray b times and insert it at the beginning:

def reorder(a,b):
    suba = [i for i in range(0, a//2)]
    subb = [f for f in range(a//2, a)]
    for i in range(b):
        suba = [suba.pop(-1)]+suba
        subb = [subb.pop(-1)]+subb
    return [suba,subb]

In[1]:  reorder(10,1)
Out[1]: [[4, 0, 1, 2, 3], [9, 5, 6, 7, 8]]


问:
Material-UI Typography doesn't center in Tool Bar
I'm trying center the text in an AppBar. I've tried centering the text in Typography element, using align="center", textAlign="center", and style={{ align: "center" }}, justify ="center" It still doesnot work. How do I centre the text?</p>

```<code>              return (
               <MuiThemeProvider theme={theme}>
               <React.Fragment>
              <div alignItems="center" justify="center">
               <AppBar position="static">
                 <Toolbar>
                 <Typography style={{ align: "center" }}>
                  Best Practices Management System
                  </Typography>
                  </Toolbar>
                  </AppBar>
                   </div>
</code>```

答:
Typography in material itself has align as prop</p>

```<code><Typography align='center'>
    Best Practices Management System
</Typography>
</code>```

Body:
I'm trying center the text in an AppBar. I've tried centering the text in Typography element, using align="center", textAlign="center", and style={{ align: "center" }}, justify ="center" It still doesnot work. How do I centre the text?

              return (
               <MuiThemeProvider theme={theme}>
               <React.Fragment>

               <AppBar position="static">
                 <Toolbar>
                 <Typography style={{ align: "center" }}>
                  Best Practices Management System
                  </Typography>
                  </Toolbar>
                  </AppBar>

Body:
Typography in material itself has align as prop

<Typography align='center'>
    Best Practices Management System
</Typography>


问:
How to mapping an Object with ArrayList with Retrofit2?
I have trying to make this call works, but always the return is null (and the problem isn't on API). If I try to make a Call  (Object with ArrayList), the callback is successful but the body is null. How I mapping this with Retrofit2 (I'm new with Retrofit2)? This is my service:

```<code>  @GET("farms/abstract")
  Call<Farm> getFarmList(@Header("Authorization") String token);
</code>```

The API response:

```<code>{
    "farms": [
        {
            "id": "0fc2b30c-4500-c399-4171-e2809373e281",
            "name": "Areado"
        },
        {
            "id": "81041a28-1193-4310-b616-fabcabdf63d1",
            "name": "Fazenda 3"
        }
    ]
}
</code>```

I use jsonschema2pojo.org to make my classes:

```<code>public class Farm {
    @SerializedName("farms")
    @Expose
    private List<FarmList> farms;

    public Farm() {
    }

    public List<FarmList> getFarms() {
        return farms;
    }

    public void setFarms(List<FarmList> farms) {
        this.farms = farms;
    }

    @Override
    public String toString() {
        return "Farm{" +
                "farms=" + farms +
                '}';
    }
}
</code>```

My FarmList.class:

```<code>public class FarmList {

    @SerializedName("id")
    @Expose
    private String id;
    @SerializedName("name")
    @Expose
    private String name;

    public FarmList() {
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "FarmList{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}
</code>```

RetrofitConfig:

```<code>public class RetrofitConfig {
    private final Retrofit retrofit;

    public RetrofitConfig() {
        this.retrofit = new Retrofit.Builder()
                /*URL API*/
                .baseUrl("API_URL")

                .addConverterFactory(GsonConverterFactory.create())

                .build();
    }

    public LoginService getLogin() {
        return this.retrofit.create(LoginService.class);
    }

    public FarmService getFarm() {
        return this.retrofit.create(FarmService.class);
    }

    public FarmService getFarmList() {
        return this.retrofit.create(FarmService.class);
    }
}
</code>```

答:
I remove the Retrofit2 and use the OkHttpClient/ObjectMapper:</p>

```<code> private void okHttpFarmClient() {
        OkHttpClient okHttpClient = new OkHttpClient();

        String url = "URL/farms/abstract";

        Request request = new Request.Builder()
                .url(url)
                .header("Authorization", "Bearer " + authToken)
                .build();
        okHttpClient.newCall(request).enqueue(new okhttp3.Callback() {
            @Override
            public void onFailure(@NonNull okhttp3.Call call, @NonNull IOException e) {
                e.printStackTrace();
            }

            @Override
            public void onResponse(@NonNull okhttp3.Call call, @NonNull okhttp3.Response response) throws IOException {
                if (response.isSuccessful()) {

                    ObjectMapper objectMapper = new ObjectMapper();
                    String farmResponse = response.body().string();
                    farm = objectMapper.readValue(farmResponse, Farm.class);
                    try {
                        farm = objectMapper.readValue(farmResponse, Farm.class);
                        farmListArrayList = farm;
                        createFarmRecyclerView();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }

                    FazendaActivity.this.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Log.d("OkHttpRun", "run: " + farmResponse);
                        }
                    });
                }
            }
        });
    }
</code>```

Body:
I have trying to make this call works, but always the return is null (and the problem isn't on API). If I try to make a Call  (Object with ArrayList), the callback is successful but the body is null. How I mapping this with Retrofit2 (I'm new with Retrofit2)? This is my service:

  @GET("farms/abstract")
  Call<Farm> getFarmList(@Header("Authorization") String token);

The API response:

{
    "farms": [
        {
            "id": "0fc2b30c-4500-c399-4171-e2809373e281",
            "name": "Areado"
        },
        {
            "id": "81041a28-1193-4310-b616-fabcabdf63d1",
            "name": "Fazenda 3"
        }
    ]
}

I use jsonschema2pojo.org to make my classes:

public class Farm {
    @SerializedName("farms")
    @Expose
    private List<FarmList> farms;

    public Farm() {
    }

    public List<FarmList> getFarms() {
        return farms;
    }

    public void setFarms(List<FarmList> farms) {
        this.farms = farms;
    }

    @Override
    public String toString() {
        return "Farm{" +
                "farms=" + farms +
                '}';
    }
}

My FarmList.class:

public class FarmList {

    @SerializedName("id")
    @Expose
    private String id;
    @SerializedName("name")
    @Expose
    private String name;

    public FarmList() {
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "FarmList{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}

RetrofitConfig:

public class RetrofitConfig {
    private final Retrofit retrofit;

    public RetrofitConfig() {
        this.retrofit = new Retrofit.Builder()
                /*URL API*/
                .baseUrl("API_URL")

                .addConverterFactory(GsonConverterFactory.create())

                .build();
    }

    public LoginService getLogin() {
        return this.retrofit.create(LoginService.class);
    }

    public FarmService getFarm() {
        return this.retrofit.create(FarmService.class);
    }

    public FarmService getFarmList() {
        return this.retrofit.create(FarmService.class);
    }
}

Body:
I remove the Retrofit2 and use the OkHttpClient/ObjectMapper:

 private void okHttpFarmClient() {
        OkHttpClient okHttpClient = new OkHttpClient();

        String url = "URL/farms/abstract";

        Request request = new Request.Builder()
                .url(url)
                .header("Authorization", "Bearer " + authToken)
                .build();
        okHttpClient.newCall(request).enqueue(new okhttp3.Callback() {
            @Override
            public void onFailure(@NonNull okhttp3.Call call, @NonNull IOException e) {
                e.printStackTrace();
            }

            @Override
            public void onResponse(@NonNull okhttp3.Call call, @NonNull okhttp3.Response response) throws IOException {
                if (response.isSuccessful()) {

                    ObjectMapper objectMapper = new ObjectMapper();
                    String farmResponse = response.body().string();
                    farm = objectMapper.readValue(farmResponse, Farm.class);
                    try {
                        farm = objectMapper.readValue(farmResponse, Farm.class);
                        farmListArrayList = farm;
                        createFarmRecyclerView();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }

                    FazendaActivity.this.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Log.d("OkHttpRun", "run: " + farmResponse);
                        }
                    });
                }
            }
        });
    }


问:
Missing values of map(key, value) in Freemarker when access randomly?
I'm having a strange problem with Freemarker map. My example is meant to display a list of cars with the associated owners' name:

Car(id,name,ownerId)

User(id,name)

Notice that the ownerId is the only bridge I can access owner from car. For some reasons, we don't create hibernate relation for these domains.

I added to model a list carList of Car(id,name,ownerId) and a Map<String, String> map which contains (userId, name) of all users.. It's because Freemarker only accept Map with key of type String.

While looping through the carList, I try to get the owner name through the map.

```<code><#list carList as car>
  ${map?values[car.ownerId]} - ${car.ownerId}<br/>
</#list>
</code>```

But the strange thing is that the result I got:

```<code>Tom - 1
Jerry - 2
Jerry - 2
David - 4
- 5
- 5
</code>```

The name of user "5" is missing, but it exists in the database. Besides, when I loop through the map the result is right:

```<code><#list map?keys as key>
  ${key} - ${map[key]}
</#list>
</code>```

The results:

```<code>1 - Tom
2 - Jerry
3 - Mickey
4 - David
5 - Mike
</code>```

The missing name happens for only a specific user. Do anyone know what is missing here?

答:
The answer given by Chaquotay is correct, though I want to add another way to work around this trouble. Since the application function naturally when use the map as a simple list, we can loop it over, compare the result and print if equality happens. It's kind of dirty, but it works.</p>

```<code><#list carList  as car>
  ${car.ownerId} -
  <#list map?keys as user_id>
    <#if car.ownerId == user_id>${map[user_id]}</#if>
  </#list>
  <br />
</#list>
</code>```

Body:
I'm having a strange problem with Freemarker map. My example is meant to display a list of cars with the associated owners' name:

Car(id,name,ownerId)

User(id,name)

Notice that the ownerId is the only bridge I can access owner from car. For some reasons, we don't create hibernate relation for these domains.

I added to model a list carList of Car(id,name,ownerId) and a Map<String, String> map which contains (userId, name) of all users.. It's because Freemarker only accept Map with key of type String.

While looping through the carList, I try to get the owner name through the map.

<#list carList as car>
  ${map?values[car.ownerId]} - ${car.ownerId}

</#list>

But the strange thing is that the result I got:

Tom - 1
Jerry - 2
Jerry - 2
David - 4
- 5
- 5

The name of user "5" is missing, but it exists in the database. Besides, when I loop through the map the result is right:

<#list map?keys as key>
  ${key} - ${map[key]}
</#list>

The results:

1 - Tom
2 - Jerry
3 - Mickey
4 - David
5 - Mike

The missing name happens for only a specific user. Do anyone know what is missing here?

Body:
The answer given by Chaquotay is correct, though I want to add another way to work around this trouble. Since the application function naturally when use the map as a simple list, we can loop it over, compare the result and print if equality happens. It's kind of dirty, but it works.

<#list carList  as car>
  ${car.ownerId} -
  <#list map?keys as user_id>
    <#if car.ownerId == user_id>${map[user_id]}</#if>
  </#list>
  <br />
</#list>


问:
Call to undefined method PDO::last_Insert_Id()
I'm getting an error message: Call to undefined method PDO::last_Insert_Id()

Here's my code:

```<code>$testcode = $conn -> prepare("INSERT INTO tblCategory
                             (Category, DisplayOrder)
                             VALUES('Test', 0)");
try {
            $testcode ->execute();
            $ID = $conn->last_Insert_Id();
}

catch (PDOException $e)
    {echo $e->getMessage();
}
</code>```

var_dump($conn instance of PDO) returns bool(true) so $conn is the PDO connection.

How do I correct so I don't get the error? I do need that last inserted id. Thanks.

答:
This PDO method is called lastInsertId(), not last_Insert_Id().

So:

```<code>$ID = $conn->lastInsertId();
</code>```

Body:
I'm getting an error message: Call to undefined method PDO::last_Insert_Id()

Here's my code:

$testcode = $conn -> prepare("INSERT INTO tblCategory
                             (Category, DisplayOrder)
                             VALUES('Test', 0)");
try {
            $testcode ->execute();
            $ID = $conn->last_Insert_Id();
}

catch (PDOException $e)
    {echo $e->getMessage();
}

var_dump($conn instance of PDO) returns bool(true) so $conn is the PDO connection.

How do I correct so I don't get the error? I do need that last inserted id. Thanks.

Body:
This PDO method is called lastInsertId(), not last_Insert_Id().

So:

$ID = $conn->lastInsertId();