Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+0016 遍历List时如何获取元素索引值 index #39

Open
toly1994328 opened this issue Jun 5, 2020 · 2 comments
Open

+0016 遍历List时如何获取元素索引值 index #39

toly1994328 opened this issue Jun 5, 2020 · 2 comments
Labels
point The point of Flutter

Comments

@toly1994328
Copy link
Owner

No description provided.

@toly1994328
Copy link
Owner Author

  • 使用List.asMap遍历
void t2() {
  List a = ['a','b','c','d'];
  a.asMap().forEach((index, value)=>print('--$index-----$value--------'));
}

--0-----a--------
--1-----b--------
--2-----c--------
--3-----d--------

@toly1994328 toly1994328 added the point The point of Flutter label Jun 5, 2020
@josercc
Copy link

josercc commented Oct 8, 2022

@toly1994328 我有个疑问 将数组转成字典 字典特点是无序在循环遍历的时候。在Dart中这样用会不会出现问题?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
point The point of Flutter
Projects
None yet
Development

No branches or pull requests

2 participants