How to create an empty list in Dart

前端 未结 1 606
逝去的感伤
逝去的感伤 2021-01-17 07:13

I want to create an empty list for a Flutter project.

final prefs = await SharedPreferences.getInstance();
final myStringList = prefs.getStringList(\'my_stri         


        
1条回答
  •  有刺的猬
    2021-01-17 07:53

    There are a few ways to create an empty list in Dart:

    []
    List()
    []
    List()
    

    However, the Effective Dart Usage Guide recommends this:

    []
    

    Or if you need to specify the type, then this:

    []
    

    0 讨论(0)
提交回复
热议问题