deakjahn / sqflite_web

A web plugin for https://github.com/tekartik/sqflite
Other
36 stars 20 forks source link

Undefined name 'SqflitePluginWeb' #17

Closed ristiisa closed 3 years ago

ristiisa commented 3 years ago

I'm not really sure this is a bug or an issue with this library. But asking still...

When I add the dependency to a project the generated_plugin_registrant.dart has some errors:

% flutter analyze 
Running "flutter pub get" in web...                              1,354ms
Analyzing web...                                                        

   info • Unused import: 'package:sqflite_web/sqflite_web.dart' • lib/generated_plugin_registrant.dart:7:8 • unused_import
  error • Undefined name 'SqflitePluginWeb' • lib/generated_plugin_registrant.dart:13:3 • undefined_identifier

A minimal error producing pubspec.yaml:

name: web
description: A new Flutter project.
version: 1.0.0+1
environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  sqflite_web:
    git:
      url: https://github.com/deakjahn/sqflite_web.git
      ref: 16350eaeaeee949db3c073cbc95a5e3f2880f096

flutter:
  uses-material-design: true

I'm asking because the project runs and works in web but tooling seems to be confused about it...

I'm running Flutter stable 2.2.2

deakjahn commented 3 years ago

No, that's quite common that the IDE shows errors or wavy underlines while the project still runs. If it does, it's just a nuisance.

Such false errors can usually be suppressed but in this case, this is an automatically generated file, so whatever comment you put there will be removed the next time around...

shaozict commented 2 years ago

export 'src/sqflite_web_stub.dart' if (dart.library.html) 'src/sqflite_web.dart'; The error should be caused by this. It's not necessary.It should be written as export 'src/sqflite_web.dart';

deakjahn commented 2 years ago

I don't think so. First, it's not an error, it's an IDE warning. Second, it will seemingly go away but the plugin will no longer be able to compile correctly on different platforms then. The if is there for a reason...