Type 'String' is not a subtype of type 'int' of 'index'

learn to type
type thesaurus
learn to type for kids
type racer
how to pronounce type
nitro type
type game
type verb

My App can authenticate successfully when debugging against the Android emulator, but if I try to authenticate using debugging against the physical device (with same OS version), an error message appears after more than one minute waiting:

Exception has occurred.

_TypeError (type 'String' is not a subtype of type 'int' of 'index')

The error message points to the following code:

        if (responseJson[AuthUtils.authTokenKey] != null) {
          AuthUtils.insertDetails(
              userNameController.text, passwordController.text, responseJson);
...
        } else {
...
        };

And in the DEBUG CONSOLE I get the following:

I/flutter ( 9531): Auth: SocketException: OS Error: Connection timed out, errno = 110, address = example.com, port = 38975 V/InputMethodManager( 9531): Starting input: tba=android.view.inputmethod.EditorInfo@4aece4e nm : example.com.todoapp ic=null

Here is the screenshot:

What am I doing wrong here ?

I believe that in the line:

responseJson[AuthUtils.authTokenKey]

You're referencing an item in the list responseJson by the index AuthUtils.authTokenKey

And since AuthUtils.authTokenKey is a String, you cannot use it as in index of an array.

So you need first to get the index of AuthUtils.authTokenKey then use it to reference the item:

responseJson[responseJson.indexOf(AuthUtils.authTokenKey)]

TypingClub: Learn Touch Typing Free, Type definition, a number of things or persons sharing a particular characteristic, or set of characteristics, that causes them to be regarded as a group, more or  type, kind, sort, nature, description, character mean a number of individuals thought of as a group because of a common quality or qualities. type may suggest strong and clearly marked similarity throughout the items included so that each is typical of the group. one of three basic body types kind may suggest natural grouping.

For my case responseJson was of dynamic data type what i did was to cast it to string.

change this

responseJson[AuthUtils.authTokenKey]

to this

String jsonsDataString = responseJson.toString();
final jsonData = jsonDecode(jsonsDataString);

//then you can get your values from the map
if(jsonData[AuthUtils.authTokenKey] != null){
...
}

Type, Typing Lessons. Take typing speed test, practice your touch typing skills, learn to type faster and with fewer errors with this free online typing tutor. Type definition, a number of things or persons sharing a particular characteristic, or set of characteristics, that causes them to be regarded as a group, more or less precisely defined or designated; class; category: a criminal of the most vicious type.

I had an issue very similar to this. It was caused by a conditional assignment to a var that was causing the type to change at run time. Take a look at what NetworkUtil.authencateUser is returning. I bet it's a Future Try changing it to a Future>.

Do you have a different SHA1 key for your emulator? That could be the cause of the differences between the two environments.

Typing practice, The award-winning online typing competition, TypeRacer, is the best free typing game in the world. Race against live opponents typing quotes from books,  Having the ability to type without looking at the keyboard is the most important factor in achieving a fast typing speed. Even if you have memorized many of the keys, unfamiliar keys will slow you down just like speed bumps on the freeway.

Check whether the response is returning an Array of data.

{[{authTokenKey: 'asbc'}]}

In this case, you need to take the [0] element. Then you will get the Map in which you can access indexes with String values.

var authTokenElm = responseJson[0];
var authToken = authTokenElm[AuthUtils.authTokenKey];

Learn to Type, type meaning: 1. a particular group of people or things that share similar characteristics and form a smaller…. Learn more. What is TypingClub? TypingClub is the most effective way to learn how to type. It is web based and highly effective. TypingClub is (and will always be) free for both individuals and schools. There is an optional paid school edition. Get Started Now

TypeRacer, ZType is sponsored by Typesy. If you would like to learn how to type faster, we highly recommend Typesy. It's by far the most awesome Typing program out there  TypingTest.com offers a free online Typing Test and exciting typing games and keyboarding practice. Check your wpm for free now!

TYPE, NounEdit. type (plural types). A grouping based on shared characteristics; a class​. quotations ▽. The How-to-Type.com typing lessons will teach you to touch type using the standard QWERTY typing technique. The lessons consist of basic typing and finger training exercises to guide you through the skills for typing each key.

ZType – Typing Game, Words. More options.. Start Typing Test. Train Typing Skills. What if you could type as fluently as you speak? Typing Trainer web typing course will get you there! To be clear, TypeRacer is not an easy typing game, but it will actually make you a better typist than those easy typing games for kids. It makes you type the same sort of text you would see at typing jobs. Don't know how to type yet? Then learn to type! Just grab a free typing tutor or read a free typing tutorial.

Comments
  • responseJson seems to be inferred as type List and expects an integer in the index accessor responseJson[intIndexhere], but AuthUtils.authTokenKey is a String which is not supported here. That would only be supported if responseJson would be a Map
  • Tried your solution, but instead getting the error message in the screenshot, I got the following: Could not load source 'dart:core/runtime/libstring_patch.dart': <source not available>.