Skip to content

I GOT ERROR The following assertion was thrown building: type 'String' is not a subtype of type 'int' of 'index' #56206

Description

@toure5013

Widget tacheUser(devoirs) {
print(devoirs);
Color color = Color(devoirs["color"] ?? 0xFF42A5F5);

return Row(
  mainAxisAlignment: MainAxisAlignment.spaceBetween,
  children: <Widget>[
    //SizedBox(width: 20,),
    //L'HEURE ICI
    ClipRRect(
      borderRadius: BorderRadius.circular(80.0),
      child: Text(
        "_debut",
        maxLines: 1,
        style: TextStyle(
            fontSize: 20.0, color: Colors.orange[100], letterSpacing: 5),
      ),
    ),
    ClipRRect(
      borderRadius: BorderRadius.circular(80.0),
      child: Padding(
        padding: const EdgeInsets.symmetric(vertical: 15.0),
        child: tacheInfo(devoirs["title"], devoirs["description"], color),
      ),
    ),
    ClipRRect(
      borderRadius: BorderRadius.circular(80.0),
      child: Text(
        "_fin",
        maxLines: 1,
        style: TextStyle(
            fontSize: 20.0, color: Colors.red[200], letterSpacing: 5),
      ),
    ),
  ],
);

}
}

Steps to Reproduce

  1. Run flutter create bug.
  2. Update the files as follows: ...
  3. ...

Expected results:

Actual results:

Logs

Activity

  1. toure5013 commented on May 2, 2020

    @toure5013
    Author

    ════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
    The following assertion was thrown building:
    type 'String' is not a subtype of type 'int' of 'index'

    Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
    In either case, please report this assertion by filing a bug on GitHub:
    https://github.com/flutter/flutter/issues/new?template=BUG.md

    When the exception was thrown, this was the stack:
    #0 _CalendarPageState.tacheUser (package:ilm/src/screens/calendar/calendar_page.dart:193:33)
    #1 _CalendarPageState.build. (package:ilm/src/screens/calendar/calendar_page.dart:162:39)
    #2 SliverChildBuilderDelegate.build (package:flutter/src/widgets/sliver.dart:446:15)
    #3 SliverMultiBoxAdaptorElement._build. (package:flutter/src/widgets/sliver.dart:1260:67)
    #4 _HashMap.putIfAbsent (dart:collection-patch/collection_patch.dart:139:29)
    ...
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    I/flutter ( 4251): {"color":"Colors.teal","debut":9,"description":"DESCRIPTION 1......","fin":20,"jourDebut":"Lun","jourFin":"Mer","title":"TITRE 2"}

    ════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
    type 'String' is not a subtype of type 'int' of 'index'
    ════════════════════════════════════════════════════════════════════════════════════════════════════

    ════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
    type 'String' is not a subtype of type 'int' of 'index'
    ════════════════════════════════════════════════════════════════════════════════════════════════════

    ════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
    type 'String' is not a subtype of type 'int' of 'index'
    ════════════════════════════════════════════════════════════════════════════════════════════════════

    ════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
    type 'String' is not a subtype of type 'int' of 'index'
    ════════════════════════════════════════════════════════════════════════════════════════════════════

    ════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
    type 'String' is not a subtype of type 'int' of 'index'
    ════════════════════════════════════════════════════════════════════════════════════════════════════

    ════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
    type 'String' is not a subtype of type 'int' of 'index'
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    Reloaded 7 of 634 libraries in 942ms.
    I/chatty ( 4251): uid=10089(com.example.ilm) Thread-2 identical 4 lines
    I/flutter ( 4251): {"color":"Colors.teal","debut":9,"description":"DESCRIPTION 1......","fin":20,"jourDebut":"Lun","jourFin":"Mer","title":"TITRE 2"}

  2. imeDevelopers commented on May 2, 2020

    @imeDevelopers

    @toure5013

    change
    {"color":"Colors.teal" ...
    to
    {"color": Colors.teal ...

    and

    Color color = Color(devoirs["color"] ?? 0xFF42A5F5);
    to
    Color color = devoirs["color"] ?? Color(0xFF42A5F5);

  3. jonahwilliams commented on May 2, 2020

    @jonahwilliams
    Contributor

    The Github issue tracker is for bugs and features requests for the Flutter SDK. Help and support questions like these are better suited for Q&A sites like StackOverflow or on one of the flutter community sites at https://flutter.dev/community .

  4. github-actions commented on Aug 21, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  5. locked as resolved and limited conversation to collaborators on Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions