Error when adding provider package to flutter web project

Your question is already answered here: https://github.com/rrousselGit/provider/issues/82

Use flutter_web branch of kevmoo's https://github.com/kevmoo/provider povider fork as:

dependencies:
  flutter_web: any
  flutter_web_ui: any
  provider: any

dependency_overrides:
  flutter_web:
    git:
      url: https://github.com/flutter/flutter_web
      path: packages/flutter_web
  flutter_web_ui:
    git:
      url: https://github.com/flutter/flutter_web
      path: packages/flutter_web_ui
  provider:
    git:
      url: https://github.com/kevmoo/provider
      ref: flutter_web