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 7/14/2019 10:03:40 AM



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.


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