I am trying to provide the download option for the flutter app,

here I am hitting the rest API , which gives the response like below

    "headers": {
        "name": "name",
        "c": "c",
        "java": "java",
        "flutter": "flutter"
    "total": 3101, //total records inside that report

    "data": [
            "Reg No": "1XX19XX400",
            "name": "abc",
            "c": "91",
            "java": "81",
            "flutter": "71"
            "Reg No": "1XX19XX401", //It wont be present in header section bcz we keep it as a default
            "name": "xyz",
            "c": "90",
            "java": "60",
            "flutter": "70"
            "Reg No": "1XX19XX402",
            "name": "pqr",
            "c": "88",
            "java": "78",
            "flutter": "98"
... remaining records.

once download is clicked I want to write this on excel sheet something like below,

Reg.No name c java flutter
1XX19XX400 abc 91 81 71
1XX19XX401 xyz 90 60 70

so a file should gets downloaded in the phone once download is clicked.

can anybody help me by giving the approach to do the same or any helpful information for adding this feature.