Hi there chinthaka160,
We understand your iPhone 6 isn't charging when connected to a charger and you're prompted to unlock the iPhone, and we'd like to share a resource that can help.
Check it out here: Using USB accessories with iOS 11.4.1 and later
Specifically, the details below may help:
"Starting with iOS 11.4.1, if you use USB accessories with your iPhone, iPad, or iPod touch, or if you connect your device to a Mac or PC, you might need to unlock your device for it to recognize and use the accessory. Your accessory then remains connected, even if your device is subsequently locked.
If you don’t first unlock your password-protected iOS device—or you haven’t unlocked and connected it to a USB accessory within the past hour—your iOS device won’t communicate with the accessory or computer, and in some cases, it might not charge. You might also see an alert asking you to unlock your device to use accessories."
Cheers!