Unhandled Exception: Invalid argument(s) Flutter

We using Bloc pattern in our project. In page A, it has a textView and a button . When textView is tapped, it will pass the list to page B. The list will then populate in listView page B.

When the row of listView is clicked, it will pass the selected data back to page A and add it to sink . It works exactly like how the startActivityForResult in Android.

TextField

   StreamBuilder(
                          stream: _bloc.locationListStream,
                          builder: (context, snapshot) {
                            return TextField(
                              onTap: () {
                                _goToPageB(snapshot.data); 
                              },
                              style: TextStyle(fontSize: 12.0, height: 1.0),
                              onChanged: (text) =>
                                  _bloc.locationSink.add(text),
                                       .....
                              controller: _locationController,
                            );
                          },
                        ),


void _goToPageB(List locationList) async {
    var results = await Navigator.of(context)
        .push(MaterialPageRoute<dynamic>(builder: (BuildContext context) {
      return PageB(locationList);
    }));

    if (results != null) {
      setState(() {
        _locationController.text = results.name;
      });
      _bloc.locationSink.add(results.id);  // set the returned data to sink      
    }
  }

When the button in page A is clicked, it will call submit() in bloc class.We want it print out the value, but we get this error.

E/flutter ( 8944): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Invalid argument(s)

bloc class

  final _location = BehaviorSubject<String>();
  get locationSink => _location.sink;
  get locationStream => _location.stream;

Future submit(
      BuildContext context) async {
    final location = _location.value;
    print('The value is '+location);
 }

@wseng92 Do you still have issues with this?

No,it solved. Thanks