shamblett / mqtt_client

A server and browser based MQTT client for dart
Other
548 stars 176 forks source link

The name 'ConnectionState' is defined in libraries 'package:flutter/src/widgets/async.dart' and 'package:mqtt_client/mqtt_client.dart' #50

Closed zqiangliu closed 5 years ago

zqiangliu commented 5 years ago

when using ConnectionState.connected enum , got this error: The name 'ConnectionState' is defined in libraries 'package:flutter/src/widgets/async.dart' and 'package:mqtt_client/mqtt_client.dart'

Is there something wrong ?

import 'package:flutter/material.dart'; import 'dart:async'; import 'package:mqtt_client/mqtt_client.dart';

shamblett commented 5 years ago

OK, this must be flutter specific, I'm not seeing it on the VM itself, as a test could you import the mqtt client with a prefix, i.e. import 'package:mqtt_client/mqtt_client.dart' as mqtt;', you would then need to update your code to use the prefix when needed(analyser should tell you this) and see if the error goes away.

shamblett commented 5 years ago

ConnectionState has now been renamed to MqttConnectionState to avoid any name clashes, client re-published at 5.0.0, please retest