'The key [GlobalObjectKey int#a1467] was used by multiple widgets
I have project that have very long sheet code on each page without Bloc or other code separation. I have this code, that must open dialog with location peeker in one page:
showDialog(
            context: context,
            builder: (BuildContext context) {
              return LocationPickerDialog(_address);
            }).then....
After clicking, a bug occurs. In project no GlobalKeys.In other page this code don't bug.
The key [GlobalObjectKey int#a1467] was used by multiple widgets. The parents of those widgets were different widgets that both had the following description:
Builder(dependencies: [MediaQuery])
A GlobalKey can only be specified on one widget at a time in the widget tree.
how to understand why this is happening?
What widget is causing this?
UPDATE:
class LocationPickerDialog extends StatefulWidget {
  var retrieveAddress;
  LocationPickerDialog(this.retrieveAddress);
  @override
  _LocationPickerDialogState createState() =>
      new _LocationPickerDialogState(retrieveAddress);
}
class _LocationPickerDialogState extends State<LocationPickerDialog> {
  var retrieveAddress;
  _LocationPickerDialogState(this.retrieveAddress);
  final searchLinkHolder = TextEditingController();
  final addressHolder = TextEditingController();
  var searchLink;
  var _address;
  var Address = "";
  List<String> placeList = [];
  var Locationlist = <beanLocation>[];
  @override
  void initState() {
    super.initState();
  }
  getSuggestions(String query) {
    if (query.isNotEmpty) {
      API.getPlaceSearchAPI(query).then((response) {
        setState(() {
          Iterable list = json.decode(response.body)['features'];
          Locationlist =
              list.map((model) => beanLocation.fromJson(model)).toList();
        });
      });
      setState(() {
        placeList.clear();
        for (int i = 0; i < Locationlist.length; i++) {
          Constant_Class.printMessage(
              "Locationlist => $i" + Locationlist[i].name.toString());
          placeList.add(Locationlist[i].name);
        }
      });
    } else {
      Constant_Class.printMessage("Locationlist => 123");
    }
  }
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      // designSize: Constant_Class.screenSize(context),
      builder: (_) => Scaffold(
        backgroundColor: Colors.transparent,
        resizeToAvoidBottomInset: false,
        body: Stack(
          children: [
            GestureDetector(
              onTap: () {
                Navigator.pop(context);
              },
              child: Container(
                color: Colors.black.withOpacity(0.5),
              ),
            ),
            Container(
              margin: EdgeInsets.only(right: 20, left: 20, bottom: 20, top: 20),
              child: Container(
                decoration: BoxDecoration(
                  borderRadius: new BorderRadius.all(const Radius.circular(30)),
                  color: Colors.white,
                ),
                padding: EdgeInsets.all(10),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Align(
                      alignment: Alignment.topRight,
                      child: InkWell(
                        onTap: () {
                          Navigator.pop(context);
                        },
                        child: Container(
                            margin:
                            EdgeInsets.only(right: 10, top: 5, bottom: 5),
                            height: 35,
                            width: 35,
                            padding: EdgeInsets.all(5),
                            decoration: BoxDecoration(
                                shape: BoxShape.circle,
                                color: ColorsApp.colorSelectedTab),
                            child: Center(
                              child: Icon(
                                Icons.close_rounded,
                                color: Colors.white,
                              ),
                            )),
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.all(5),
                      padding: EdgeInsets.all(12),
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                          borderRadius:
                          new BorderRadius.all(const Radius.circular(30)),
                          border: Border.all(color: Colors.black, width: 1.0)),
                      child: TextFormField(
                        controller: searchLinkHolder,
                        textAlignVertical: TextAlignVertical.center,
                        textInputAction: TextInputAction.done,
                        cursorColor: Colors.black,
                        style: TextStyle(
                            fontFamily: Constant_Class.appFontFamily,
                            color: Colors.black),
                        decoration: new InputDecoration(
                            border: InputBorder.none,
                            focusedBorder: InputBorder.none,
                            enabledBorder: InputBorder.none,
                            errorBorder: InputBorder.none,
                            disabledBorder: InputBorder.none,
                            isDense: true,
                            contentPadding: EdgeInsets.only(top: 3),
                            filled: false,
                            //fillColor: Theme.of(context).cardColor,
                            labelStyle: TextStyle(
                                fontFamily: Constant_Class.appFontFamily,
                                fontSize: 16,
                                fontWeight: FontWeight.normal,
                                color: Colors.black),
                            hintStyle: TextStyle(
                                fontFamily: Constant_Class.appFontFamily,
                                fontSize: 16,
                                fontWeight: FontWeight.normal,
                                color: Colors.grey),
                            hintText: 'google_meet'.tr()),
                        keyboardType: TextInputType.text,
                        onSaved: (val) {
                          searchLink = val;
                        },
                        onChanged: (val) {
                          searchLink = val;
                        },
                        onFieldSubmitted: (value) {
                          // if(value != null && value.trim() != ""){
                          //   Navigator.of(context).pop(value);
                          // }
                          setState(() {
                            searchLink = value;
                          });
                          if (value != null && Uri.parse(value).host != "") {
                            Constant_Class.locationLatitude = "";
                            Constant_Class.locationLongitude = "";
                            Constant_Class.printMessage(value);
                            Navigator.of(context).pop(value);
                          } else {
                            Constant_Class.ToastMessage(
                                'Please enter valid url');
                          }
                        },
                      ),
                    ),
                    SizedBox(
                      height: 10,
                    ),
                    _textWithRightLeftLine('or'.tr()),
                    SizedBox(
                      height: 10,
                    ),
                    Container(
                      margin: EdgeInsets.all(5),
                      padding: EdgeInsets.all(12),
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                          borderRadius:
                          new BorderRadius.all(const Radius.circular(30)),
                          border: Border.all(color: Colors.black, width: 1.0)),
                      child: TextFormField(
                        controller: addressHolder,
                        textAlignVertical: TextAlignVertical.center,
                        textInputAction: TextInputAction.done,
                        cursorColor: Colors.black,
                        style: TextStyle(
                            fontFamily: Constant_Class.appFontFamily,
                            color: Colors.black),
                        decoration: new InputDecoration(
                            border: InputBorder.none,
                            focusedBorder: InputBorder.none,
                            enabledBorder: InputBorder.none,
                            errorBorder: InputBorder.none,
                            disabledBorder: InputBorder.none,
                            isDense: true,
                            contentPadding: EdgeInsets.only(top: 3),
                            filled: false,
                            //fillColor: Theme.of(context).cardColor,
                            labelStyle: TextStyle(
                                fontFamily: Constant_Class.appFontFamily,
                                fontSize: 16,
                                fontWeight: FontWeight.normal,
                                color: Colors.black),
                            hintStyle: TextStyle(
                                fontFamily: Constant_Class.appFontFamily,
                                fontSize: 16,
                                fontWeight: FontWeight.normal,
                                color: Colors.grey),
                            hintText: 'search_location'.tr()),
                        keyboardType: TextInputType.text,
                        onSaved: (val) {
                          _address = val;
                          getSuggestions(val.toString());
                        },
                        onChanged: (val) {
                          _address = val;
                          getSuggestions(val.toString());
                        },
                        onFieldSubmitted: (value) {
                          Constant_Class.locationLatitude = "";
                          Constant_Class.locationLongitude = "";
                          setState(() {
                            _address = value;
                          });
                          if (searchLink != null &&
                              Uri.parse(searchLink).host != "") {
                            Constant_Class.printMessage(searchLink);
                            Navigator.of(context).pop(searchLink);
                          } else {
                            Navigator.of(context).pop(_address);
                          }
                        },
                      ),
                    ),
                    Expanded(
                      child: ListView.separated(
                        physics: BouncingScrollPhysics(
                            parent: AlwaysScrollableScrollPhysics()),
                        shrinkWrap: true,
                        itemCount: placeList.length,
                        separatorBuilder: (BuildContext context, int index) =>
                            Divider(),
                        itemBuilder: (BuildContext context, int index) {
                          return ListTile(
                            dense: true,
                            title: InkWell(
                              onTap: () {
                                Constant_Class.locationLatitude =
                                    Locationlist[index].latitude;
                                Constant_Class.locationLongitude =
                                    Locationlist[index].longitude;
                                Navigator.of(context)
                                    .pop(placeList[index].toString());
                              },
                              // child: Text(placeList[index].toString()),
                              child: Text(
                                placeList[index].toString(),
                                textAlign: TextAlign.left,
                                style: TextStyle(
                                    fontFamily: Constant_Class.appFontFamily,
                                    fontWeight: FontWeight.w500,
                                    color: Colors.black,
                                    fontSize: 16),
                              ),
                            ),
                          );
                        },
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
  Widget _textWithRightLeftLine(var title) {
    return Container(
      child: Column(
        children: [
          Row(
            children: [
              Expanded(
                child: new Container(
                    margin: const EdgeInsets.only(left: 0.0, right: 10.0),
                    child: Container(
                      color: ColorsApp.colorTextLight,
                      height: 1,
                    )),
              ),
              Text(
                title,
                style: TextStyle(
                    color: ColorsApp.colorTextDark,
                    fontFamily: Constant_Class.appFontFamily),
              ),
              Expanded(
                child: new Container(
                    margin: const EdgeInsets.only(left: 10.0, right: 0.0),
                    child: Container(
                      color: ColorsApp.colorTextLight,
                      height: 1,
                    )),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
https://drive.google.com/file/d/1KRidmPbZJeobB6FCG2TZmn1ENFvkAojj/view?usp=sharing
							
						Solution 1:[1]
I found what it was. in this screen and in the dialog root widget was ScreenUtilInit from the flutter_screenutil package. I deleted this from one page and the problem was solved.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | 
