Filter by Widgets


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
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

Horizontal List View

Check out this article on Horizontal List View

Read full post

How to get the Width and Height of the Screen in Flutter?

Check out this article on How to get the Width and Height of the Screen in Flutter?

Read full post

How to add a Footer Buttons in Flutter?

Check out this article on How to add a Footer Buttons in Flutter?

Read full post

TextField in Flutter

Check out this article on TextField in Flutter

Read full post

How to Draw a Triangle using Canvas in Flutter?

Check out this article on How to Draw a Triangle using Canvas in Flutter?

Read full post

url_launcher Package - Lets Launch URL, Send Email, Make Call or Send SMS in Flutter

Check out this article on url_launcher Package - Lets Launch URL, Send Email, Make Call or Send SMS in Flutter

Read full post

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'.

Check out this article on 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'.

Read full post

How to create a persistent bottom sheet in Flutter?

Check out this article on How to create a persistent bottom sheet in Flutter?

Read full post

How to draw a Decorative Horizontal line in Flutter?

Check out this article on How to draw a Decorative Horizontal line in Flutter?

Read full post

How to fetch an Image from Internet in Flutter

Check out this article on How to fetch an Image from Internet in Flutter

Read full post

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

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License , and code samples are licensed under the BSD License.