Error: The name 'RangeSlider' is defined in the libraries 'package:flutter/src/material/range_slider.dart' and 'package:flutter_range_slider/src/flutter_range_slider.dart'.

This Errors is posted by seven.srikanth at 14-07-2019 10:03:40

Hello guys,
In the errors, probably you must be seeing the below two errors. 
{
  "resource": "/C:/Users/seven/Documents/GitHub/Grocery-App/f_groceries/lib/item_screen.dart",
  "owner": "dart",
  "code": "strong_mode_invalid_cast_new_expr",
  "severity": 8,
  "message": "The constructor returns type 'dynamic' that isn't of expected type 'Widget'.",
  "source": "dart",
  "startLineNumber": 1484,
  "startColumn": 22,
  "endLineNumber": 1484,
  "endColumn": 507,
  "tags": []
}
{
  "resource": "/C:/Users/seven/Documents/GitHub/Grocery-App/f_groceries/lib/item_screen.dart",
  "owner": "dart",
  "code": "ambiguous_import",
  "severity": 8,
  "message": "The name 'RangeSlider' is defined in the libraries 'package:flutter/src/material/range_slider.dart' and 'package:flutter_range_slider/src/flutter_range_slider.dart'.\nTry using 'as prefix' for one of the import directives, or hiding the name from all but one of the imports.",
  "source": "dart",
  "startLineNumber": 1484,
  "startColumn": 26,
  "endLineNumber": 1484,
  "endColumn": 37,
  "tags": []
}
In order to fix this, we need to use 'as prefix' in the imports section.
Let me be more specific.
Probably you will be having this code in your imports section. 
import 'package:flutter_range_slider/flutter_range_slider.dart';
 
and you need to change that as below. 
import 'package:flutter_range_slider/flutter_range_slider.dart' as rngslider;
And then you need to call the widgets as below,
rngslider.RangeSlider
this type of calling should be done in all the places where you want the above import to be used. 
Hopefully your issue will be resolved now. 
Thanks,
Srikanth

Tags: The constructor returns type dynamic that isn't of expected type Widget; The name RangeSlider is defined in the libraries;



0 Comments
Login to comment.
Recent Comments

Be the first to Comment. You can ask a Query or Share your toughts or Just say thanks.



Recent Articles


How to deploy flutter web site on GitHub using peanut

Posted by nikhilchaudhary12155 on 13 Oct 2019 Article


AnimatedPositioned Widget Example in Flutter

Posted by seven.srikanth on 10 Oct 2019 Article


Flutter Open-Source and directory lists

Posted by nishantkotatech on 09 Oct 2019 Article


Flutter Travelling Couple Leading Page - Flutter Web Series 3

Posted by nikhilchaudhary12155 on 05 Oct 2019 Article



© 2018 - Fluttercentral | Email to me - Seven.srikanth@gmail.com