본문 바로가기
Computer Engineering/안드로이드 Flutter

[Flutter] 다른 클래스에서 리스트 처리

by UC우공 2019. 11. 10.
==================dataBox.dart=======================
class Data {
  String text;
  String author;

  Data ({this.text, this.author} );
}
=====================================================

==================main.dart==========================

  List<Data> quotes = [
    Data(text:'123', author:'MK1    ' ),
    Data(text:'456', author:'MK2              ' ),
    Data(text:'789', author:'MK3              ' ),
  ];
  
  
  
===============Scanfold 내부========================
   Column(

             mainAxisAlignment: MainAxisAlignment.end,
             crossAxisAlignment: CrossAxisAlignment.stretch,
             children: quotes.map((abc) => dataTemplate(abc)).toList(),
             
            )//Text(quotes[0]),
  
=====================================================
  

댓글